<template>
  <el-scrollbar ref="scrollbarRef" always @scroll="scroll">
    <el-row class="app-container" id="detail" ref="detail" justify="space-between">
      <el-col class="detail-container" :span="18" :lg="18" :xl="19">
        <el-form class="el-form-register" ref="detailForm" :inline="true" label-width="230px" :model="params"
          :rules="rules">
          <!-- 项目基本情况表 -->
          <div class="el-form-ls">
            <Title ref="baseInfo" id="baseInfo" name="项目基本情况表" level="1" @toggleShow="toggleShow('baseInfo')"></Title>
            <div class="baseinfo" v-show="showBaseInfo">
              <el-form-item class="el-form-whole" label="项目名称" prop="projectName">
                <el-input v-model="params.projectName" placeholder="请输入"></el-input>
              </el-form-item>
              <el-form-item class="el-form-whole" label="项目概况" prop="survey">
                <el-input v-model="params.survey" placeholder="请输入,500字以内" :rows="3" type="textarea" maxlength="500"
                  show-word-limit resize="none" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="项目位置(中心位置)" :rules="[{ required: true }]">
                <el-form-item class="el-form-sub" label-width="90" label="经度" prop="longitudeP" style="width: 100%">
                  <el-input v-model="params.longitudeP" placeholder="请输入"></el-input>
                </el-form-item>
                <br />
                <el-form-item class="el-form-sub" label-width="90" label="纬度" prop="latitudeP" style="width: 100%">
                  <el-input v-model="params.latitudeP" placeholder="请输入"></el-input>
                </el-form-item>
                <!--zyt修改start-->
                <div style="position: absolute;width: 100%;height: 1px;top: 39px;left: 0px;background: lightgrey;">
                </div>
                <div style="margin-left:20px;height:40px;display: flex;flex-direction: row;">
                  <el-button type="primary" @click="selectUploadFileClick()">
                    <span v-if="params.cpFile != ''">重新上传</span>
                    <span v-else>上传文件</span>
                    <input type="file" @change="uploadFileChange()" style="width: 70px;display:none"
                      :id="('saResults-button-selectfile')" multiple="multiple"
                      accept=".shp,.dbf,.prj,.sbn,.sbx,.shp.xml,.shx,.cpg" />
                  </el-button>
                  <el-form-item class="el-form-sub" label-width="0" label="" prop="cpFile" style="width: 100%;flex:1">
                    <el-input v-model="params.cpFile" placeholder="上传文件名称" style="margin-left: 20px;"
                    readonly></el-input>
                  </el-form-item>
                </div>
                <div style="position: absolute;width: 100%;height: 1px;top: 79px;left: 0px;background: lightgrey;">
                </div>
                <div style="height:200px;">
                  <!--地图-->
                  <ResultMap v-if="params.geomText != ''" :geomText="params.geomText"></ResultMap>
                </div>
                <!--zyt修改end-->
              </el-form-item>
              <el-form-item class="el-form-half" label="所在行政区（乡镇级别）：" prop="administrativeRegion">
                <el-cascader :props="xzqProps" placeholder="请选择" v-model="params.administrativeRegion"
                  @change="xzqChange" />
              </el-form-item>
              <el-form-item class="el-form-half" style="border-left: none" label="提交报告日期(到月)" prop="subDate">
                <el-date-picker v-model="params.subDate" type="month" value-format="YYYY-MM" placeholder="请选择" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="评审单位" prop="reviewUnit">
                <el-input v-model="params.reviewUnit" placeholder="请输入"></el-input>
              </el-form-item>
              <el-form-item class="el-form-whole" label="承担单位" prop="undertaker">
                <el-input v-model="params.undertaker" placeholder="请输入"></el-input>
              </el-form-item>
              <el-form-item class="el-form-whole" label="委托单位" prop="client">
                <el-input v-model="params.client" placeholder="请输入"></el-input>
              </el-form-item>
              <el-form-item class="el-form-whole" label="工程类别" prop="projectType">
                <el-select v-model="params.projectType" placeholder="请选择" class="form-select" @change="projectTypeChange">
                  <el-option v-for="item in projectTypeOptions" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
                <div class="project-type-remarks">
                  <img v-if='params.projectTypeAttchPath' :src="params.projectTypeAttchPath"
                    style="height:170px;margin-right:15px;" />
                  <span style="color:#b1b3b8">{{ params.projectTypeRemarks }}</span>
                </div>
              </el-form-item>
              <el-form-item label="安评等级：" class="form-item el-form-half" prop="safetyRating">
                <el-select v-model="params.safetyRating" placeholder="请选择" class="form-select">
                  <el-option v-for="item in safetyRatingOptions" :key="item.value" :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item class="el-form-half" style="border-left: none" label="钻孔数量" prop="controlPoints">
                <el-input v-model.number="params.controlPoints" placeholder="请输入"></el-input>
              </el-form-item>
              <!-- <el-form-item class="el-form-whole" label="" prop="evaluationResults">
                <template #label>
                  评价结论<br />(设防水平相当于区划图)
                </template>
                <el-input v-model="params.evaluationResults" placeholder="请输入,800字以内" :rows="5" type="textarea"
                  maxlength="800" show-word-limit resize="none" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="与区划图比较" prop="compare">
                <el-input v-model="params.compare" placeholder="请输入,800字以内" :rows="5" type="textarea"
                  maxlength="800" show-word-limit resize="none" />
              </el-form-item> -->
              <el-form-item class="el-form-whole" label="登记人" required>
                {{ params.registrant }}
              </el-form-item>
              <el-form-item class="form-item el-form-half" label="录入时间" required>
                {{ params.createTime }}
              </el-form-item>
              <el-form-item class="el-form-half" style="border-left: none" label="登记单位" required>
                {{ params.registrationUnit }}
              </el-form-item>
            </div>
          </div>
          <!-- 关键性图件 -->
          <div class="el-form-ls">
            <Title ref="keyMap" id="keyMap" name="关键性图件" level="1" @toggleShow="toggleShow('keyMap')"></Title>
            <div class="img-containers" v-show="showKeyMap">
              <el-form-item class="el-form-whole" label="（一）区域地震构造图" prop="rsMap">
                <file-upload ref="fileuploadRsMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handleFileSuccess" />
                <ImageLook v-if="params.rsMap" :attachId="params.rsMap" @deleteImage="deleteImageRsMap" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（二）本次新增加的断层剖面图" prop="fpMap">
                <file-upload ref="fileuploadFpMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlefpMapFileSuccess" />
                <ImageLook v-if="params.fpMap" :attachId="params.fpMap" @deleteImage="deleteImageFpMap" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（三）近场地震构造图" prop="nfssMap">
                <file-upload ref="fileuploadNfssMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlenfssMapFileSuccess" />
                <ImageLook v-if="params.nfssMap" :attachId="params.nfssMap" @deleteImage="deleteImageNfssMap" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（四）区域地震震中分布图" prop="reedMap">
                <file-upload ref="fileuploadReedMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlereedMapFileSuccess" />
                <ImageLook v-if="params.reedMap" :attachId="params.reedMap" @deleteImage="deleteImageReedMap" />
              </el-form-item>
              <!-- // refz值必须是唯一的，，一会自己删除或改名唯一 -->
              <el-form-item class="el-form-whole" label="（五）近场地震震中分布图" prop="nfeedMap">
                <file-upload ref="fileuploadNfeedMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlenfeedMapFileSuccess" />
                <ImageLook v-if="params.nfeedMap" :attachId="params.nfeedMap" @deleteImage="deleteImageNfeedMap" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（六）潜在震源区图" prop="psaMap">
                <file-upload ref="fileuploadPsaMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlepsaMapFileSuccess" />
                <ImageLook v-if="params.psaMap" :attachId="params.psaMap" @deleteImage="deleteImagePsaMap" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（七）钻孔柱状图" prop="bhMap">
                <file-upload ref="fileuploadBhMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlebhMapFileSuccess" />
                <ImageLook v-if="params.bhMap" :attachId="params.bhMap" @deleteImage="deleteImageBhMap" />
              </el-form-item>
              <!-- “安评等级”选择“3”或者选择“2+3”时，此图片必填项。 -->
              <el-form-item v-if="params.safetyRating == '3' || params.safetyRating == '2+3'" class="el-form-whole"
                label="（八）地震动参数分区" prop="seismicPz">
                <file-upload ref="fileuploadSeismicPz" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handleseismicPzFileSuccess" />
                <ImageLook v-if="params.seismicPz" :attachId="params.seismicPz" @deleteImage="deleteImageSeismicPz" />
              </el-form-item>
              <el-form-item v-else class="el-form-whole" label="（八）地震动参数分区">
                <file-upload ref="fileuploadSeismicPz" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handleseismicPzFileSuccess" />
                <ImageLook v-if="params.seismicPz" :attachId="params.seismicPz" @deleteImage="deleteImageSeismicPz" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（九）钻孔分布图" prop="bdMap">
                <file-upload ref="fileuploadBdMap" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handlebdMapFileSuccess" />
                <ImageLook v-if="params.bdMap" :attachId="params.bdMap" @deleteImage="deleteImageBdMap" />
              </el-form-item>
              <el-form-item class="el-form-whole" label="（十）工程地质剖面图" prop="egProfile">
                <file-upload ref="fileuploadEgProfile" :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']"
                  :fileSize="15" :action="upload.url" :disabled="upload.isUploading" :auto-upload="true" :showList='false'
                  :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                  :on-error="handleFileUploadError" @uploadFile="handleegProfileFileSuccess" />
                <ImageLook v-if="params.egProfile" :attachId="params.egProfile" @deleteImage="deleteImageEgProfile" />
              </el-form-item>
            </div>
          </div>

          <!-- 关键性数据表格 -->
          <div class="el-form-ls">
            <Title ref="keyTable" id="keyTable" name="关键性数据表格" level="1" @toggleShow="toggleShow('keyTable')"></Title>
            <div v-show="showKeyTable">
              <div class="historicalEarthquakeCatalogue">
                <Title ref="historicalEarthquakeCatalogue-1" id="historicalEarthquakeCatalogue-1" name="（一）历史地震目录"
                  own="keyTable" level="2"></Title>
                <el-table class="listTable" ref="multipleTableRef" border
                  :data="params.historyEarthquakeCatalogueTableData" style="width: 100%"
                  :cell-style="{ border: '1px solid #e5ebf7' }"
                  :header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
                  <el-table-column type="index" width="75" label="编号">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">编号</span>
                    </template>
                  </el-table-column>
                  <el-table-column header-align="center" align="center">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">发震时间</span>
                    </template>
                    <el-table-column prop="eoTimeYmd" header-align="center" align="center" width="130">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">年月日</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                          scope.$index + '.eoTimeYmd'" :rules="rules.eoTimeYmd">
                          <el-input v-model="scope.row.eoTimeYmd" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="eoTimeHms" header-align="center" align="center" width="130">
                      <template #header>
                        <span class="column-header-label">时分秒</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'historyEarthquakeCatalogueTableData.' + scope.$index + '.eoTimeHms'">
                          <el-time-picker v-model="scope.row.eoTimeHms" format="HH:mm:ss" value-format="hh:mm:ss"
                            placeholder="请选择" style="width:130px;" size="small"/>
                        </el-form-item>
                      </template>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column label="震中位置" header-align="center" align="center">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">震中位置</span>
                    </template>
                    <el-table-column label="北纬" prop="northLatitude" header-align="center" align="center" width="110">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">北纬</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                          scope.$index + '.northLatitude'" :rules="rules.northLatitude">
                          <el-input v-model="scope.row.northLatitude" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="东经" prop="eastLongitude" header-align="center" align="center" width="110">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">东经</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                          scope.$index + '.eastLongitude'" :rules="rules.eastLongitude">
                          <el-input v-model="scope.row.eastLongitude" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                  </el-table-column>
                  <el-table-column prop="magnitude" header-align="center" align="center" label="震级M">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">震级M</span>
                    </template>
                    <template #default="scope">
                      <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                        scope.$index + '.magnitude'" :rules="rules.magnitude">
                        <el-input v-model="scope.row.magnitude" size="small"></el-input>
                      </el-form-item>
                    </template>
                  </el-table-column>
                  <el-table-column prop="depth" header-align="center" align="center" label="深度km">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">深度km</span>
                    </template>
                    <template #default="scope">
                      <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                        scope.$index + '.depth'" :rules="rules.depth">
                        <el-input v-model="scope.row.depth" size="small" type="number"></el-input>
                      </el-form-item>
                    </template>
                  </el-table-column>
                  <el-table-column prop="epicentralIntensity" header-align="center" align="center" label="震中烈度">
                    <template #default="scope">
                      <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                        scope.$index + '.epicentralIntensity'" :rules="rules.epicentralIntensity">
                        <el-input v-model="scope.row.epicentralIntensity" size="small"></el-input>
                      </el-form-item>
                    </template>
                  </el-table-column>
                  <el-table-column prop="accuracy" header-align="center" align="center" label="精度">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">精度</span>
                    </template>
                    <template #default="scope">
                      <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                        scope.$index + '.accuracy'" :rules="rules.accuracy">
                        <el-input v-model="scope.row.accuracy" size="small"></el-input>
                      </el-form-item>
                    </template>
                  </el-table-column>
                  <el-table-column prop="erpName" header-align="center" align="center" label="震中参考地名">
                    <template #header>
                      <span class="column-header-sign">*</span>
                      <span class="column-header-label">震中参考地名</span>
                    </template>
                    <template #default="scope">
                      <el-form-item :prop="'historyEarthquakeCatalogueTableData.' +
                        scope.$index + '.erpName'" :rules="rules.erpName">
                        <el-input v-model="scope.row.erpName" size="small"></el-input>
                      </el-form-item>
                    </template>
                  </el-table-column>
                  <el-table-column label="操作">
                    <template #default="scope">
                      <el-button link size="small" type="primary" @click="handleHistoryDelete(scope.$index, scope.row)">
                        删除
                      </el-button>
                    </template>
                  </el-table-column>
                </el-table>
                <el-button class="mt-4" style="width: 100%" type="primary" @click="handleHistoryAdd()">新增数据</el-button>
              </div>

              <div class="solum">
                <Title ref="solum-2" id="solum-2" name="（二）土层" level="2" own="keyTable"></Title>
                <div class="holeFormingInformation">
                  <Title ref="holeFormingInformation-1" id="holeFormingInformation-1" name="成孔信息" level="3" own="solum-2">
                  </Title>
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.holeTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7', }"
                    :header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="projectName" header-align="center" align="center" label="钻孔依托的项目">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">钻孔依托的项目</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.projectName'" :rules="rules.projectId">
                          <el-input v-model="scope.row.projectName" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="boreholeNumber" header-align="center" align="center" label="钻孔编号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">钻孔编号</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.boreholeNumber'"
                          :rules="rules.boreholeNumber">
                          <el-input v-model="scope.row.boreholeNumber" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="hlLongitude" header-align="center" align="center" label="孔位经度（°）">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">孔位经度（°）</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.hlLongitude'" :rules="rules.hlLongitude">
                          <el-input v-model="scope.row.hlLongitude" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="hlLatitude" header-align="center" align="center" label=" 孔位纬度（°）">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">孔位纬度（°）</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.hlLatitude'" :rules="rules.hlLatitude">
                          <el-input v-model="scope.row.hlLatitude" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="drillingDepth" header-align="center" align="center" label="钻孔深度（m）">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">钻孔深度（m）</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.drillingDepth'"
                          :rules="rules.drillingDepth">
                          <el-input v-model="scope.row.drillingDepth" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="groundElevation" header-align="center" align="center" label="地面高程（m）">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">地面高程（m)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.groundElevation'"
                          :rules="rules.groundElevation">
                          <el-input v-model="scope.row.groundElevation" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="groundwaterLevel" header-align="center" align="center" label="地下水位（m）">
                      <template #default="scope">
                        <el-form-item :prop="'holeTableData.' + scope.$index + '.groundwaterLevel'"
                          :rules="rules.groundwaterLevel">
                          <el-input v-model="scope.row.groundwaterLevel" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作">
                      <template #default="scope">
                        <el-button link size="small" type="primary" @click="handleHoleDelete(scope.$index, scope.row)">
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleHoleAdd()">新增数据</el-button>
                </div>

                <div class="soilDynamicParameters">
                  <Title ref="soilDynamicParameters-2" id="soilDynamicParameters-2" name="土动力参数" level="3" own="solum-2">
                  </Title>
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.soilTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7' }"
                    :header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none', }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="stNumber" header-align="center" align="center" label="土类号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">土类号</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.stNumber'" :rules="rules.stNumber">
                          <el-input v-model="scope.row.stNumber" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="geotechnicalName" header-align="center" align="center" label="岩土名称">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">岩土名称</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.geotechnicalName'"
                          :rules="rules.geotechnicalName">
                          <el-input v-model="scope.row.geotechnicalName" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="boreholeNumber" header-align="center" align="center" label="钻孔编号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">钻孔编号</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.boreholeNumber'"
                          :rules="[{ required: true, message: '请输入钻孔编号', trigger: 'blur' }, { validator: checkHoleNum, trigger: 'blur' }]">
                          <el-input v-model="scope.row.boreholeNumber" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="bdosSample" header-align="center" align="center" label="土样埋深">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">土样埋深</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.bdosSample'" :rules="rules.bdosSample">
                          <el-input v-model="scope.row.bdosSample" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="parameterSource" header-align="center" align="center" label="参数来源">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">参数来源</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.parameterSource'"
                          :rules="rules.parameterSource">
                          <el-select v-model="scope.row.parameterSource" size="small" placeholder="请选择"
                            class="form-select">
                            <el-option v-for="item in parameterSourceOptions" :key="item.value" :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="sdDensity" header-align="center" align="center" label="密度(kg/m3)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">密度(kg/m3)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.sdDensity'" :rules="rules.sdDensity">
                          <el-input v-model="scope.row.sdDensity" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>

                    <!-- 要完善 -->
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×0.05)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×0.05)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio1'"
                          :rules="rules.modulusRatio1">
                          <el-input v-model="scope.row.modulusRatio1" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×0.10)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×0.10)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio2'"
                          :rules="rules.modulusRatio2">
                          <el-input v-model="scope.row.modulusRatio2" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×0.50)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×0.50)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio3'"
                          :rules="rules.modulusRatio3">
                          <el-input v-model="scope.row.modulusRatio3" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10-4×1.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10-4×1.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio4'"
                          :rules="rules.modulusRatio4">
                          <el-input v-model="scope.row.modulusRatio4" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×5.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×5.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio5'"
                          :rules="rules.modulusRatio5">
                          <el-input v-model="scope.row.modulusRatio5" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×10.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×10.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio6'"
                          :rules="rules.modulusRatio6">
                          <el-input v-model="scope.row.modulusRatio6" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×50.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×50.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio7'"
                          :rules="rules.modulusRatio7">
                          <el-input v-model="scope.row.modulusRatio7" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="模量比(G/Gmax)剪应变(γ)（10^-4×100.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">模量比(G/Gmax)剪应变(γ)（10^-4×100.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.modulusRatio8'"
                          :rules="rules.modulusRatio8">
                          <el-input v-model="scope.row.modulusRatio8" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×0.05)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×0.05)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio1'"
                          :rules="rules.dampingRatio1">
                          <el-input v-model="scope.row.dampingRatio1" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×0.10)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×0.10)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio2'"
                          :rules="rules.dampingRatio2">
                          <el-input v-model="scope.row.dampingRatio2" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×0.50)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×0.50)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio3'"
                          :rules="rules.dampingRatio3">
                          <el-input v-model="scope.row.dampingRatio3" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×1.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×1.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio4'"
                          :rules="rules.dampingRatio4">
                          <el-input v-model="scope.row.dampingRatio4" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×5.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×5.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio5'"
                          :rules="rules.dampingRatio5">
                          <el-input v-model="scope.row.dampingRatio5" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×10.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×10.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio6'"
                          :rules="rules.dampingRatio6">
                          <el-input v-model="scope.row.dampingRatio6" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×50.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×50.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio7'"
                          :rules="rules.dampingRatio7">
                          <el-input v-model="scope.row.dampingRatio7" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="阻尼比(λ)剪应变(γ)（10^-4×100.00)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比(λ)剪应变(γ)（10^-4×100.00)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'soilTableData.' + scope.$index + '.dampingRatio8'"
                          :rules="rules.dampingRatio8">
                          <el-input v-model="scope.row.dampingRatio8" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" fixed="right">
                      <template #default="scope">
                        <el-button link size="small" type="text" @click="handleSoilDelete(scope.$index, scope.row)">删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleSoilAdd()">新增数据</el-button>
                </div>

                <div class="drillingCalculationModel">
                  <!-- <h5>钻孔计算模型</h5> -->
                  <Title ref="drillingCalculationModel-3" id="drillingCalculationModel-3" name="钻孔计算模型" level="3"
                    own="solum-2"></Title>
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.drillingTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7' }"
                    :header-cell-style="{ border: '1px solid #e5ebf7', borderLeft: 'none' }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="geotechnicalName" header-align="center" align="center" label="岩土名称">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">岩土名称</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'drillingTableData.' +
                          scope.$index +
                          '.geotechnicalName'
                          " :rules="rules.geotechnicalName">
                          <el-input v-model="scope.row.geotechnicalName" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="stNumber" header-align="center" align="center" label="土类号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">土类号</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'drillingTableData.' + scope.$index + '.stNumber'" :rules="rules.stNumber">
                          <el-input v-model="scope.row.stNumber" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="lbDepth" header-align="center" align="center" label="层底深度(m)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">层底深度(m)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'drillingTableData.' + scope.$index + '.lbDepth'" :rules="rules.lbDepth">
                          <el-input v-model="scope.row.lbDepth" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="geotechnicalDensity" header-align="center" align="center" label="密度(kg/m^3)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">密度(kg/m3)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'drillingTableData.' +
                          scope.$index +
                          '.geotechnicalDensity'
                          " :rules="rules.geotechnicalDensity">
                          <el-input v-model="scope.row.geotechnicalDensity" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="layerThickness" header-align="center" align="center" label="层厚(m)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">层厚(m)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'drillingTableData.' + scope.$index + '.layerThickness'
                          " :rules="rules.layerThickness">
                          <el-input v-model="scope.row.layerThickness" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="swVelocity" header-align="center" align="center" label="剪切波波速V(m/s)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">剪切波波速V(m/s)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'drillingTableData.' + scope.$index + '.swVelocity'
                          " :rules="rules.swVelocity">
                          <el-input v-model="scope.row.swVelocity" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作">
                      <template #default="scope">
                        <el-button link size="small" type="primary"
                          @click="handleDrillingDelete(scope.$index, scope.row)">
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleDrillingAdd()">新增数据
                  </el-button>
                </div>
              </div>

              <div class="historicalEarthquakeCatalogue">
                <Title ref="historicalAssessment-3" id="historicalAssessment-3" name="（三）地震地质灾害评价" level="2"
                  own="keyTable"></Title>
                <el-form-item class="el-form-whole" label="">
                  <el-input v-model="params.saghEvaluation" placeholder="" :rows="5" type="textarea" maxlength="500"
                    show-word-limit resize="none" />
                </el-form-item>
              </div>

              <div class="siteConditionEvaluation">
                <Title ref="siteConditionEvaluation-4" id="siteConditionEvaluation-4" name="（四）场地类别" level="2"
                  own="keyTable"></Title>
                <div class="holeFormingInformation">
                  <h5>场地类别判别信息表</h5>
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.infoTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7' }" :header-cell-style="{
                      border: '1px solid #e5ebf7',
                      borderLeft: 'none',
                    }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="boreholeNumber" header-align="center" align="center" label="钻孔编号（与土层模型相对应）">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">钻孔编号（与土层模型相对应）</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'infoTableData.' + scope.$index + '.boreholeNumber'">
                          <el-select v-model="scope.row.boreholeNumber" size="small" placeholder="请选择"
                            class="form-select">
                            <el-option v-for="item in boreholeNumberOptions" :key="item.value" :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="eswv" header-align="center" align="center" label="20m等效剪切波速（M/s）">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">20m等效剪切波速（M/s）</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'infoTableData.' + scope.$index + '.eswv'" :rules="rules.eswv">
                          <el-input v-model="scope.row.eswv" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="tocLayer" header-align="center" align="center" label="覆盖层厚度m">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">覆盖层厚度m</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'infoTableData.' + scope.$index + '.tocLayer'" :rules="rules.tocLayer">
                          <el-input v-model="scope.row.tocLayer" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="fieldType" header-align="center" align="center" label="场地类别">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">场地类别</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'infoTableData.' + scope.$index + '.fieldType'" :rules="rules.fieldType">
                          <el-select v-model="scope.row.fieldType" size="small" placeholder="请选择" class="form-select">
                            <el-option v-for="item in siteClassificationOptions" :key="item.value" :label="item.label"
                              :value="item.value">
                            </el-option>
                          </el-select>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作">
                      <template #default="scope">
                        <el-button link size="small" type="primary" @click="handlleInfoDelete(scope.$index, scope.row)">
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleInfoAdd()">新增数据</el-button>
                </div>
              </div>

              <div class="newExplorationLine">
                <Title ref="newExplorationLine-5" id="newExplorationLine-5" name="（五）新开展的勘探测线" level="2" own="keyTable">
                </Title>
                <div class="lineInformationTable">
                  <h5>测线信息表格</h5>
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.lineInfoTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7' }" :header-cell-style="{
                      border: '1px solid #e5ebf7',
                      borderLeft: 'none',
                    }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="testNumber" header-align="center" align="center" label="测线编号">
                      <template #default="scope">
                        <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.testNumber'"
                          :rules="rules.testNumber">
                          <el-input v-model="scope.row.testNumber" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="testAr" header-align="center" align="center" label="测线所在行政区（乡镇级别）"
                      min-width="200">
                      <template #default="scope">
                        <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.testAr'" :rules="rules.testAr">
                          <el-cascader :props="xzqProps" placeholder="请选择" v-model="scope.row.testAr" @change="xzqChange1"
                            ref="checkedAreaRef" size="small"/>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="constructionUnit" header-align="center" align="center" label="施工单位">
                      <template #default="scope">
                        <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.constructionUnit'"
                          :rules="rules.constructionUnit">
                          <el-input v-model="scope.row.constructionUnit" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="起点（小数点后6位）" header-align="center" align="center">
                      <el-table-column prop="startLongitude" label="经度" header-align="center" align="center" width="110">
                        <template #default="scope">
                          <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.startLongitude'"
                            :rules="rules.startLongitude">
                            <el-input v-model="scope.row.startLongitude" size="small"></el-input>
                          </el-form-item>
                        </template>
                      </el-table-column>
                      <el-table-column prop="startLatitude" label="纬度" header-align="center" align="center" width="110">
                        <template #default="scope">
                          <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.startLatitude'"
                            :rules="rules.startLatitude">
                            <el-input v-model="scope.row.startLatitude" size="small"></el-input>
                          </el-form-item>
                        </template>
                      </el-table-column>
                    </el-table-column>
                    <el-table-column label="终点（小数点后6位）" header-align="center" align="center">
                      <el-table-column prop="endLongitude" label="经度" header-align="center" align="center" width="110">
                        <template #default="scope">
                          <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.endLongitude'"
                            :rules="rules.endLongitude">
                            <el-input v-model="scope.row.endLongitude" size="small"></el-input>
                          </el-form-item>
                        </template>
                      </el-table-column>
                      <el-table-column prop="endLatitude" label="纬度" header-align="center" align="center" width="110">
                        <template #default="scope">
                          <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.endLatitude'"
                            :rules="rules.endLatitude">
                            <el-input v-model="scope.row.endLatitude" size="small"></el-input>
                          </el-form-item>
                        </template>
                      </el-table-column>
                    </el-table-column>
                    <el-table-column prop="surveyMethod" header-align="center" align="center" label="勘探方式">
                      <template #default="scope">
                        <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.surveyMethod'"
                          :rules="rules.surveyMethod">
                          <el-input v-model="scope.row.surveyMethod" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="testLength" header-align="center" align="center" label="长度km">
                      <template #default="scope">
                        <el-form-item :prop="'lineInfoTableData.' + scope.$index + '.testLength'"
                          :rules="rules.testLength">
                          <el-input v-model="scope.row.testLength" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="pposlMap" label="地震反射时间剖面和地质解释剖面" header-align="center" align="center" width="180">
                      <template #default="scope">
                        <el-form-item>
                          <image-upload ref="imageUpload" :limit="1"  v-model="scope.row.pposlMapPage" :fileType="['jpeg', 'png']" :isShowTip="false" @uploadImage="handlelineInfoTableDataCompare(scope.$index,$event)" @delImage="deleteLineInfoTableDataCompare(scope.$index)"/>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作">
                      <template #default="scope">
                        <el-button link size="small" type="primary"
                          @click="handlleLineInfoDelete(scope.$index, scope.row)">
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleLineInfoAdd()">新增数据
                  </el-button>
                  <!-- <div class="img-containers">
                    <el-form-item class="el-form-whole" label="测线剖面图片" prop="lpPicture">
                      <file-upload :limit="1" accept=".jpeg, .png" :fileType="['jpeg', 'png']" :fileSize="15"
                        :action="upload.url" :disabled="upload.isUploading" :auto-upload="true"
                        :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                        :on-error="handleFileUploadError" @uploadFile="handlelpPictureFileSuccess" />
                      <ImageLook v-if="params.fileMap && params.fileMap.lpPicture"
                        :attachId="params.fileMap.lpPicture.attachId" />
                    </el-form-item>
                  </div> -->
                </div>
              </div>

              <div class="newDevelopGeologicalProfiles">
                <Title ref="newDevelopGeologicalProfiles-6" id="newDevelopGeologicalProfiles-6" name="（六）新开展的地质剖面"
                  level="2" own="keyTable">
                </Title>
                <div class="geologicalInformationTable">
                  <h5>地质剖面信息表格</h5>
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.geologicalInfoTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7' }" :header-cell-style="{
                      border: '1px solid #e5ebf7',
                      borderLeft: 'none',
                    }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="bisectName" header-align="center" align="center" label="剖面名称">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">剖面名称</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'geologicalInfoTableData.' + scope.$index + '.bisectName'"
                          :rules="rules.bisectName">
                          <el-input v-model="scope.row.bisectName" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="sectionArea" header-align="center" align="center" label="剖面所在行政区（乡镇级别）"
                      min-width="200">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">剖面所在行政区（乡镇级别）</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'geologicalInfoTableData.' + scope.$index + '.sectionArea'"
                          :rules="rules.sectionArea">
                          <el-cascader :props="xzqProps" placeholder="请选择" v-model="scope.row.sectionArea"
                            @change="xzqChange2" ref="checkedAreaRef" size="small" />
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="longitude" label="经度" header-align="center" align="center">
                      <template #default="scope">
                        <el-form-item :prop="'geologicalInfoTableData.' + scope.$index + '.longitude'"
                          :rules="rules.longitude">
                          <el-input v-model="scope.row.longitude" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="latitude" label="纬度" header-align="center" align="center">
                      <template #default="scope">
                        <el-form-item :prop="'geologicalInfoTableData.' + scope.$index + '.latitude'"
                          :rules="rules.latitude">
                          <el-input v-model="scope.row.latitude" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="pposlMapPage" label="地质剖面图片" header-align="center" align="center" width="180">
                      <template #default="scope">
                        <el-form-item>
                          <image-upload ref="imageUpload" :limit="1"  v-model="scope.row.pposlMapPage" :isShowTip="false" :fileType="['jpeg', 'png']" @uploadImage="handlegeologicalInfoTableCompare(scope.$index,$event)" @delImage="deleteGeologicalInfoTableCompare(scope.$index)"/>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作">
                      <template #default="scope">
                        <el-button link size="small" type="primary"
                          @click="handlleGeologicalDelete(scope.$index, scope.row)">
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleGeologicalAdd()">新增数据
                  </el-button>
                  <!-- <div class="img-containers" v-if="params.geologicalInfoTableData&&params.geologicalInfoTableData.length>0">
                    <el-form-item class="el-form-whole" :label="`地质剖面图片\n(换行)`" prop="geologicalProfileImage">
                      <template #label>
                        地质剖面图片<br />(<span class="column-header-sign">*</span>请上传<span>{{ params.geologicalInfoTableData.length }}</span>张图片)
                      </template>
                      <file-upload :limit="params.geologicalInfoTableData.length" accept=".jpeg, .png" :fileType="['jpeg', 'png']" :fileSize="15"
                        :action="upload.url" :disabled="upload.isUploading" :auto-upload="true"
                        :before-upload="handleFileBeforeUpload" :on-progress="handleFileUploadProgress"
                        :on-error="handleFileUploadError" @uploadFile="handlelpgeologicalProfileSuccess" />
                      <ImageLook v-if="m_operateType === 'modify' && params.fileMap && params.fileMap.lpPicture"
                        :attachId="params.fileMap.lpPicture.attachId" />
                      <ImageLook v-else-if="params.fileMap && params.fileMap.geologicalProfileImage"
                        :attachId="params.fileMap.geologicalProfileImage.attachId" />
                    </el-form-item>
                  </div> -->
                </div>
              </div>

              <div class="siteGroundMotionParameters">
                <Title ref="siteGroundMotionParameters-7" id="siteGroundMotionParameters-7" name="（七）场地地震动参数" level="2"
                  own="keyTable"></Title>
                <div class="parametersTable">
                  <el-table class="listTable" ref="multipleTableRef" border :data="params.siteTableData"
                    style="width: 100%" :cell-style="{ border: '1px solid #e5ebf7' }" :header-cell-style="{
                      border: '1px solid #e5ebf7',
                      borderLeft: 'none',
                    }">
                    <el-table-column type="index" width="75" label="序号">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">序号</span>
                      </template>
                    </el-table-column>
                    <el-table-column prop="transcendProbability" header-align="center" align="center" label="超越概率">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">超越概率</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.transcendProbability'"
                          :rules="rules.transcendProbability">
                          <el-input v-model="scope.row.transcendProbability" size="small"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="amaxGal" header-align="center" align="center" label="Amax(gal)">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">Amax(gal)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.amaxGal'" :rules="rules.amaxGal">
                          <el-input v-model="scope.row.amaxGal" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="bm" header-align="center" align="center" label="βm">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">βm</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.bm'" :rules="rules.bm">
                          <el-input v-model="scope.row.bm" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="amax" label="αmax" header-align="center" align="center">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">αmax</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.amax'" :rules="rules.amax">
                          <el-input v-model="scope.row.amax" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="t1S" label="T1 (s)" header-align="center" align="center">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">T1 (s)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.t1S'" :rules="rules.t1S">
                          <el-input v-model="scope.row.t1S" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="tgS" label="Tg(s)" header-align="center" align="center">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">Tg(s)</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.tgS'" :rules="rules.tgS">
                          <el-input v-model="scope.row.tgS" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="v" label="γ" header-align="center" align="center">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">γ</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '.v'" :rules="rules.v">
                          <el-input v-model="scope.row.v" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column prop="dampingRatio " header-align="center" align="center" label="阻尼比">
                      <template #header>
                        <span class="column-header-sign">*</span>
                        <span class="column-header-label">阻尼比</span>
                      </template>
                      <template #default="scope">
                        <el-form-item :prop="'siteTableData.' + scope.$index + '. dampingRatio '"
                          :rules="rules.dampingRatio">
                          <el-input v-model="scope.row.dampingRatio" size="small" type="number"></el-input>
                        </el-form-item>
                      </template>
                    </el-table-column>
                    <el-table-column label="操作">
                      <template #default="scope">
                        <el-button link size="small" type="primary" @click="handlleSiteDelete(scope.$index, scope.row)">
                          删除
                        </el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <el-button class="mt-4" style="width: 100%" type="primary" @click="handleSiteAdd()">新增数据</el-button>
                  <el-form-item class="el-form-whole" label="地震动峰值加速度归档（50年10%）(g)：" prop="aospFile" required>
                    <el-input v-model="params.aospFile" placeholder="请输入" type="number"></el-input>
                  </el-form-item>
                  <el-form-item class="el-form-half" label="周期点：" prop="periodicPoint">
                    <el-input v-model="params.periodicPoint" placeholder="" type="number"></el-input>
                  </el-form-item>
                  <el-form-item class="el-form-half" style="border-left: none" label="反应谱值：" prop="rsValue">
                    <el-input v-model="params.rsValue" placeholder="" type="number"></el-input>
                  </el-form-item>
                </div>
              </div>
            </div>
          </div>

          <!-- 附件 -->
          <div class="el-form-ls">
            <Title ref="accessory" id="accessory" name="附件" level="1" @toggleShow="toggleShow('accessory')"></Title>
            <div class="img-containers" v-show="showAccessory">
              <el-form-item class="el-form-whole" label="上传报告" prop="uploadReport">
                <file-upload ref="fileUpload" :fileType="['pdf', 'doc', 'docx', 'xlsx']" :fileSize="10240"
                  v-model="params.attachList" :limit="1" :showCustomTip="true"
                  :customTipContent="'注：附件格式：pdf、doc、docx、xlsx，附件最大可上传10G文件。'" @uploadFile="handleUploadReportSuccess" />
              </el-form-item>
              <el-form-item v-if="m_operateType === 'modify'" class="el-form-whole" label="修改原由：" prop="updateReason">
                <el-input v-model="params.updateReason" placeholder=""></el-input>
              </el-form-item>
              <!-- 审批状态，如果是1，管理员显示修改详细信息，普通用户不显示
              <el-form-item v-if="m_operateType === 'modify' && approvalStatusInit == 1 && m_IsAdministrator"
                class="el-form-half" style="border-left: none" label="修改详细信息：" prop="updateDetailedInformation">
                <el-input v-model="params.updateDetailedInformation" placeholder=""></el-input>
              </el-form-item>
              <el-form-item v-else label=" " class="el-form-half"></el-form-item>
              <el-form-item v-if="m_operateType === 'delete'" class="el-form-whole" label="删除原由" prop="deleteReason">
                <el-input v-model="params.deleteReason" placeholder="请输入"></el-input>
              </el-form-item>
              待审批：0、不通过：2，都不显示
              <template v-if="isShowApply && (approvalStatusInit != 0 || approvalStatusInit != 2)">
                <el-form-item v-if="isShowApply" class="el-form-third" label="审批人">
                  {{ params.approvalUser }}
                </el-form-item>
                <el-form-item v-if="isShowApply" class="el-form-third" label="审批时间" label-width="130">
                  {{ params.approvalTime }}
                </el-form-item>
                <el-form-item v-if="isShowApply" class="el-form-third" label="审批单位" label-width="120">
                  {{ params.approvalOrg }}
                </el-form-item>
                <el-form-item v-if="isShowApply" class="el-form-half" label="审批状态：" prop="approvalStatus" required>
                  <el-select v-model="params.approvalStatus" placeholder="请选择" class="form-select">
                    <el-option v-for="item in approvalStatusOptions" :key="item.value" :label="item.label"
                      :disabled="item.disabled" :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item v-if="isShowApply" class="el-form-half" style="border-left: none" label="审批意见"
                  prop="reviewComments" required>
                  <el-input v-model="params.reviewComments" placeholder="请输入"></el-input>
                </el-form-item>
              </template> -->
            </div>
          </div>
        </el-form>
      </el-col>

      <el-col class="tree" ref="tree" :span="5" :lg="5" :xl="4">
        <div class="bottom-button">
          <div>
            <el-button type="primary" @click="onImportParms()">导入</el-button>
          </div>
          <!-- <div>
            <el-button type="primary" @click="onSave">保存</el-button>
          </div>
          <div>
            <el-button type="primary" @click="onSubmit">提交</el-button>
          </div> -->
        </div>
        <!-- 右侧列表 -->
        <ScrollBetter ref="scrollBetter" :treeData="treeData" @updateScroll="updateScroll"></ScrollBetter>
      </el-col> 

      <el-col class="tree" ref="tree" :span="18" :lg="18" :xl="19" style="text-align: right; ">
        <el-button type="primary" @click="onSave" v-if="!(route.query.operate&&route.query.operate=='modify')">保存</el-button>
        <el-button type="primary" @click="onSubmit">提交</el-button>
      </el-col>
    </el-row>

    <!--上传结果弹窗-->
    <el-dialog title="系统信息" v-model="uploadInfoVisible" width="30%" :before-close="uploadHandleClose">
      <p v-html='uploadMsg' class="new-dialog-content"></p>
      <p class="new-dialog-footer">
        <el-button type="primary" @click="uploadHandleClose">关闭</el-button>
      </p>
    </el-dialog>
    <!-- 导入数据 -->
    <ImportData v-if="dialogVisible" v-model="dialogVisible" ref="uploadRef" :downloadFileName="downloadFileName"
      :uploadUrl="uploadFileUrl" @importSuccess="onImport"></ImportData>
  </el-scrollbar>
</template>
<script setup>
import { reactive, toRefs, ref, onMounted } from "vue";
//地图
import ResultMap from '@/map/components/resultMap/map.vue';
import { Upload } from "@element-plus/icons-vue";
// 引入消息提示
import { ElMessage, ElMessageBox } from 'element-plus'
// 引入公用方法
import { parseTime } from "@/utils/ruoyi.js";
import { getToken } from "@/utils/auth";
// 引入右侧目录组件
import ScrollBetter from '@/components/ScrollBetter';
// 引入标题组件
import Title from '../components/Title.vue';
// 引入图片查看组件
import ImageLook from '../components/ImageLook.vue';
// 引入数据导入弹框组件
import ImportData from '@/components/ImportData';
// 引入表单验证
import { positivedecimals } from '@/components/FormValidate';
// 引入接口
import { getInfo } from '@/api/login'
import { getUserId } from "@/utils/auth";
import {
  safetyRatingList,
  projectTypeList,
  //queryAllProject,
  saveOrUpdateSaResults,
  xzqList,
  getSaResultsById,
  deleteSaResultsProject,
  queryUserRole,
  notSubmitted,
  queryHistory,
  uploadShpFile,
  getGeomTextByLonLatString
} from "@/api/safetyEvalutionResultsBank/safetyEvaResCatRegister.js";

// 审批状态的初始化值
const approvalStatusInit = ref(false);

// 文件上传
// 文件上传弹框组件对象
const uploadRef = ref();
// 是否显示弹框组件
const dialogVisible = ref(false);
// 上传地址
const uploadFileUrl = '/saResults/importExcelSaResults';
// 模板文件名称
const downloadFileName = '安评数据导入模板.xlsx';
// 上传完成回调
const onImport = (response, uploadFile, uploadFiles) => {
  const { code, data, message } = response;
  if (code == 200 && data) {
    // 初始化回显表单
    initFormData(data)
  }
}

//zyt修改start
//校验经纬度，最多保留N小数 ,N 在 options {decimals: N} 中定义，多个经度（纬度）用,分隔
const checkDecimalsLonLat = (rule, value, callback) => {
  value = String(value);
  //console.log("校验经纬度"+value);
  if (value == "") {
    //console.log("空值");
    return callback(new Error());//空值
  }
  let array = value.split(",");
  //允许输入多个数值用,分隔 或 只能输入1个数值
  if (rule.options.multi == true || (rule.options.multi == false && array.length == 1)) {
    for (let i = 0; i < array.length; i++) {
      let numStr = array[i];
      if (
        numStr.indexOf(".") != -1 &&
        (numStr.split(".").length > 2 ||
          numStr.split(".")[0] === "" ||
          numStr.split(".")[1] === "")
      ) {
        //console.log("防止输入多个小数点");
        return callback(new Error()); //防止输入多个小数点
      } else if (
        numStr.indexOf(".") != -1 &&
        numStr.split(".")[1].length > rule.options.decimals
      ) {
        //console.log("最多保留N小数");
        return callback(new Error()); //最多保留N小数
      } else {
        if (isNumberCheck(numStr)) {//判断是否为数值
          //数值
          let num = Number(numStr);
          if (rule.options.type == "经度" && num >= -180 && num <= 180) {//经度范围[-180,180]
            //经度
            //console.log(num+"经度校验通过");
          } else if (rule.options.type == "东经" && num >= 0 && num <= 180) {//东经范围[0,180]
            //经度
            //console.log(num+"东经校验通过");
          } else if (rule.options.type == "纬度" && num >= -90 && num <= 90) {//纬度范围[-90,90]
            //纬度
            //console.log(num+"纬度校验通过");
          } else if (rule.options.type == "北纬" && num >= 0 && num <= 90) {//北纬范围[0,90]
            //纬度
            //console.log(num+"北纬校验通过");
          } else {
            //console.log("经纬度值不符合要求");
            return callback(new Error());//经纬度值不符合要求
          }
        } else {
          //console.log("非数值");
          return callback(new Error());//非数值
        }
      }
    }
    //校验通过
    //console.log("校验通过");
    if (rule.options.getGeom == true) {//项目位置经纬度获取geomText值
      /*if((rule.options.type=="经度" && checkLonLatByType("纬度",rule.options.decimals)) ||
          (rule.options.type=="纬度" && checkLonLatByType("经度",rule.options.decimals))){
        getGeomTextByLonLatStr();//安评成果目录根据经纬度获取geomText值
      }*/
      if (rule.options.type == "纬度" && checkLonLatByType("经度", rule.options.decimals)) {
        getGeomTextByLonLatStr();//安评成果目录根据经纬度获取geomText值
      }
    }
    return callback();
  } else {
    //console.log("只能输入1个数值");
    return callback(new Error());//只能输入1个数值
  }
};
//校验是否为整数或6位小数
function isNumberCheck(value) {
  //console.log(value);
  if (value == "" || value.indexOf(" ") != -1) {
    //console.log("存在空格");
    return false;
  }
  //整数
  let reg = /^(0|[1-9][0-9]*|-[1-9][0-9]*)$/;
  //6位以内小数
  let reg1 = /^-?(\d*(?:\.\d{0,6})?)$/;
  if (reg.test(value)) {
    //console.log("整数");
    return true;
  } else if (value.indexOf(".") != -1 && reg1.test(value) && (isNumberCheck(value.split(".")[0]) || value.split(".")[0] == "-0")) {
    //console.log("6位小数");
    return true;
  } else {
    //console.log("非整数或6位小数");
    return false;
  }
}
//校验经度|纬度是否符合要求
function checkLonLatByType(type, decimals) {
  let value = "";
  if (type == "经度") {
    value = String(params.value.longitudeP);
  } else if (type == "纬度") {
    value = String(params.value.latitudeP);
  }
  console.log(value);
  if (value == "") {
    //console.log("空值");
    return false;//空值
  }
  let array = value.split(",");
  for (let i = 0; i < array.length; i++) {
    let numStr = array[i];
    if (
      numStr.indexOf(".") != -1 &&
      (numStr.split(".").length > 2 ||
        numStr.split(".")[0] === "" ||
        numStr.split(".")[1] === "")
    ) {
      //console.log("防止输入多个小数点");
      return false; //防止输入多个小数点
    } else if (
      numStr.indexOf(".") != -1 &&
      numStr.split(".")[1].length > decimals
    ) {
      //console.log("最多保留N小数");
      return false; //最多保留N小数
    } else {
      if (isNumberCheck(numStr)) {//判断是否为数值
        //数值
        let num = Number(numStr);
        if (type == "经度" && num >= -180 && num <= 180) {//经度范围[-180,180]
          //经度
          //console.log(num+"经度校验通过");
        } else if (type == "东经" && num >= 0 && num <= 180) {//东经范围[0,180]
          //经度
          //console.log(num+"东经校验通过");
        } else if (type == "纬度" && num >= -90 && num <= 90) {//纬度范围[-90,90]
          //纬度
          //console.log(num+"纬度校验通过");
        } else if (type == "北纬" && num >= 0 && num <= 90) {//北纬范围[0,90]
          //纬度
          //console.log(num+"北纬校验通过");
        } else {
          //console.log("经纬度值不符合要求");
          return false;//经纬度值不符合要求
        }
      } else {
        //console.log("非数值");
        return false;//非数值
      }
    }
  }
  //校验通过
  //console.log("校验通过");
  return true;
}
//zyt修改end

// 当前对象实例
const { proxy } = getCurrentInstance();
// 当前路由对象
const route = useRoute();
// 全局路由对象
const router = useRouter();

const eswvRule = (rule, value, callback) => {
    value = String(value);
    if (
        value.indexOf(".") != -1 &&
        (value.split(".").length > rule.options.decimals ||
            value.split(".")[0] === "" ||
            value.split(".")[1] === "")
    ) {
        callback(new Error('请输入正确数值，最多保留两位小数"')); //防止输入多个小数点
    } else if (value.indexOf(".") != -1 && value.split(".")[1].length > rule.options.decimals) {
        callback(new Error('请输入正确数值，最多保留两位小数"')); //小数点后两位
    } else {
      let index = rule.field.split('.')[1];
      params.value.infoTableData[index].fieldType = '';
      params.value.infoTableData[index].tocLayer = '';
      proxy.$refs['detailForm'].clearValidate( `infoTableData.${index}.infoTableData.tocLayer`)
      callback()
    }
};

const thicknessRule = (rule, value, callback) => {
    value = String(value);
    if (
        value.indexOf(".") != -1 &&
        (value.split(".").length > rule.options.decimals ||
            value.split(".")[0] === "" ||
            value.split(".")[1] === "")
    ) {
        callback(new Error('请输入正确数值，最多保留两位小数"')); //防止输入多个小数点
    } else if (value.indexOf(".") != -1 && value.split(".")[1].length > rule.options.decimals) {
        callback(new Error('请输入正确数值，最多保留两位小数"')); //小数点后两位
    } else {
      let index = rule.field.split('.')[1];
      let eswv = Number(params.value.infoTableData[index].eswv)
      if(eswv){
        params.value.infoTableData[index].fieldType = '';
        proxy.$refs['detailForm'].clearValidate( `infoTableData.${index}.infoTableData.fieldType`)
        if(eswv>800){
          value==0?callback(): callback(new Error('覆盖层厚度应为0'));
        }else if(eswv<=800&&eswv>500){
          value==0?callback(): callback(new Error('覆盖层厚度应为0'));
        }else{
            callback()
        }
      }else{
        callback();
      }
    }
};

const fieldTypeRule = (rule, value, callback) => {
    let index = rule.field.split('.')[1];
    let eswv = Number(params.value.infoTableData[index].eswv)
    let tocLayer = Number(params.value.infoTableData[index].tocLayer)
    if(!value){
      callback(new Error('请选择场地类别')); 
    }else{
      if(eswv>800){
        value=='10'?callback(): callback(new Error('场地类别只能选Ⅰ0'));
      }else if(eswv<=800&&eswv>500){
        value=='1'?callback(): callback(new Error('场地类别只能选Ⅰ1'));
      }else if(eswv<=500&&eswv>250){
        if(tocLayer<5){
          value=='1'?callback(): callback(new Error('场地类别只能选Ⅰ1'));
        }else{
          value=='2'?callback(): callback(new Error('场地类别只能选Ⅱ'));
        }
      }else if(eswv<=250&&eswv>150){
        if(tocLayer<3){
          value=='1'?callback(): callback(new Error('场地类别只能选Ⅰ1'));
        }else if(tocLayer>=3&&tocLayer<=50){
          value=='2'?callback(): callback(new Error('场地类别只能选Ⅱ'));
        }else{
          value=='3'?callback(): callback(new Error('场地类别只能选Ⅲ'));
        }
      }else if(eswv<=150){
        if(tocLayer<3){
          value=='1'?callback(): callback(new Error('场地类别只能选Ⅰ1'));
        }else if(tocLayer>=3&&tocLayer<=15){
          value=='2'?callback(): callback(new Error('场地类别只能选Ⅱ'));
        }else if(tocLayer>=15&&tocLayer<=80){
          value=='3'?callback(): callback(new Error('场地类别只能选Ⅲ'));
        }else{
          value=='4'?callback(): callback(new Error('场地类别只能选Ⅳ'));
        }
      }
    }
};

const data = reactive({
  showBaseInfo: true, //是否显示项目基本情况表
  showKeyMap: true,
  showKeyTable: true,
  showAccessory: true,
  treeData: [],
  // 表单参数
  params: {
    projectName: "", //项目名称
    survey: "", //项目概况
    longitudeP: "", //项目经度
    latitudeP: "", //项目纬度
    //zyt修改start
    cpFile: "",//中心文件位置点线文件
    geomText: "",//空间数据
    //zyt修改end
    administrativeRegion: [], //所在行政区
    subDate: "", //提交日期
    reviewUnit: "", //评审单位
    undertaker: "", //承担单位
    client: "", //委托单位
    projectType: "", //工程类别
    projectTypeRemarks: "", //工程类别备注
    safetyRating: "", //安评等级
    controlPoints: "", //钻孔数量
    evaluationResults: "", //评价结论
    compare: "", //与区划图比较
    registrant: "", //登记人
    createTime: "", //录入时间
    registrationUnit: "", //登记单位
    aospFile: "", //地震动峰值加速度归档（50年10%）(g)
    periodicPoint: "", // 周期点
    rsValue: "", // 反应谱值
    uploadReport: "",//上传报告
    saghEvaluation: "", // 地震地质灾害评价
    updateReason: "", //修改原由
    updateDetailedInformation: "", //修改详细信息
    deleteReason: "", //删除原由,
    reviewComments: '',//审核意见
    // 钻孔计算模型
    drillingTableData: [
      {
        geotechnicalName: "",
        stNumber: "",
        lbDepth: "",
        geotechnicalDensity: "",
        layerThickness: "",
        swVelocity: "",
      },
    ],
    historyEarthquakeCatalogueTableData: [
      {
        eoTimeYmd: "",
        eoTimeHms: "",
        northLatitude: "",
        eastLongitude: "",
        magnitude: "",
        depth: "",
        epicentralIntensity: "",
        accuracy: "",
        erpName: "",
      },
    ],
    holeTableData: [
      {
        projectName: "",
        boreholeNumber: "",
        hlLongitude: "",
        hlLatitude: "",
        groundElevation: "",
        groundwaterLevel: "",
      }
    ],
    soilTableData: [
      {
        id: 1,
        stNumber: "",
        geotechnicalName: "",
        boreholeNumber: "",
        bdosSample: "",
        parameterSource: "",
        sdDensity: "",
        modulusRatio1: "",
        modulusRatio2: "",
        modulusRatio3: "",
        modulusRatio4: "",
        modulusRatio5: "",
        modulusRatio6: "",
        modulusRatio7: "",
        modulusRatio8: "",
        dampingRatio1: "",
        dampingRatio2: "",
        dampingRatio3: "",
        dampingRatio4: "",
        dampingRatio5: "",
        dampingRatio6: "",
        dampingRatio7: "",
        dampingRatio8: "",
      },
    ],
    infoTableData: [
      {
        boreholeNumber: "",
        eswv: "",
        tocLayer: "",
        fieldType: "",
      }
    ],
    lineInfoTableData: [
      {
        id: "1",
        testNumber: "",
        testAr: "",
        constructionUnit: "",
        startLongitude: "",
        startLatitude: "",
        endLongitude: "",
        endLatitude: "",
        surveyMethod: "",
        testLength: "",
        pposlMap:'',
        pposlMapPage:[]
      },
    ],
    geologicalInfoTableData: [
      {
        id: "1",
        bisectName: "",
        sectionArea: "",
        longitude: "",
        latitude: "",
        pposlMap:[],
        pposlMapPage:[]
      },
    ],
    siteTableData: [
      {
        id: "1",
        transcendProbability: "50年10%",
        amaxGal: "65",
        bm: "2.5",
        amax: "0.166",
        t1S: "0.10",
        tgS: "54.4746",
        v: "0.9",
        dampingRatio: "0.9",
      },
    ]
  },
  rules: {
    projectName: [
      { required: true, message: "请输入项目名称", trigger: "blur" },
      { max: 50, message: "最多输入50个字", trigger: ["change", "blur"] },
    ],
    survey: [
      { required: true, message: "请输入项目概况", trigger: "blur" },
      { max: 500, message: "最多输入500个字", trigger: ["change", "blur"] },
    ],
    longitudeP: [
      { required: true, message: "请输入经度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数，多个经度用,分隔",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: true, type: "经度", getGeom: true },
        trigger: ["blur"],
      },
    ],
    latitudeP: [
      { required: true, message: "请输入纬度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数，多个纬度用,分隔",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: true, type: "纬度", getGeom: true },
        trigger: ["blur"],
      },
    ],
    //zyt修改start
    cpFile: [
      { message: "请上传Shp文件", trigger: "blur" }
    ],
    geomText: [
      { message: "请上传Shp文件", trigger: "blur" }
    ],
    //zyt修改end
    administrativeRegion: [
      { required: true, message: "请选择所在行政区", trigger: "blur" },
    ],
    subDate: [
      { required: true, message: "请选择提交报告日期", trigger: "blur" },
    ],
    reviewUnit: [
      { required: true, message: "请输入评审单位", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    undertaker: [
      { required: true, message: "请输入承担单位", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    client: [
      { required: false, message: "请输入委托单位", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    projectType: [
      { required: true, message: "请选择工程类别", trigger: "change" }
    ],
    safetyRating: [
      { required: true, message: "请选择安评等级", trigger: "blur" },
    ],
    controlPoints: [
      { required: true, message: "请输入钻孔数量", trigger: "blur" },
      { type: 'number', max: 100000, message: "请输入数字，最多五个", trigger: ["change", "blur"] },
      // { max: 5, message: "最多输入5个字", trigger: ["change", "blur"] },
    ],
    evaluationResults: [
      { required: true, message: "请输入评价结论", trigger: "blur" },
      { max: 800, message: "最多输入800个字", trigger: ["change", "blur"] },
    ],
    compare: [
      { required: true, message: "请输入与区划图比较", trigger: "blur" },
      { max: 800, message: "最多输入800个字", trigger: ["change", "blur"] },
    ],
    deleteReason: [
      { required: true, message: "请输入删除原由", trigger: "blur" },
    ],
    uploadReport: [
      { required: true, message: "请上传报告" },
    ],
    // 关键性图件
    rsMap: [{ required: true, message: "请上传区域地震构造图" }],
    fpMap: [{ required: false, message: "请上传本次新增加的断层剖面图" }],
    nfssMap: [{ required: true, message: "请上传近场地震构造图" }],
    reedMap: [{ required: true, message: "请上传区域地震震中分布图" }],
    nfeedMap: [{ required: true, message: "请上传近场地震震中分布图" }],
    psaMap: [{ required: true, message: "请上传潜在震源区图" }],
    // bhMap: [{ required: true, message: "请上传钻孔柱状图" }],
    seismicPz: [{ required: true, message: "请上传地震动参数分区" }],
    // bdMap: [{ required: true, message: "请上传钻孔分布图" }],
    // egProfile: [{ required: true, message: "请上传工程地质剖面图" }],
    geologicalProfileImage: [{ required: false, message: "请上传地质剖面图片" }],//测线剖面图片
    lpPicture: [{ required: false, message: "请上传测线剖面图片" }],//测线剖面图片
    //历史地震目录
    northLatitude: [
      { required: true, message: "请输入纬度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "北纬" },
        trigger: ["change", "blur"],
      },
    ],
    eastLongitude: [
      { required: true, message: "请输入经度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "东经" },
        trigger: ["change", "blur"],
      },
    ],
    magnitude: [
      { required: true, message: "请输入震级", trigger: "blur" },
      { max: 10, message: "最多输入10个字", trigger: ["change", "blur"] },
    ],
    depth: [
      { required: true, message: "请输入深度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    epicentralIntensity: [
      // 震中烈度非必填
      // { required: true, message: "请输入震中烈度", trigger: "blur" },
      { max: 3, message: "最多输入3个字", trigger: ["change", "blur"] },
    ],
    accuracy: [
      { required: true, message: "请输入精度", trigger: "blur" },
      { max: 20, message: "最多输入20个字", trigger: ["change", "blur"] },
    ],
    erpName: [
      { required: true, message: "请输入震中参考地名", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    //土层
    //成孔信息
    boreholeNumber: [
      { required: true, message: "请输入钻孔编号", trigger: "blur" },
    ],
    hlLongitude: [
      { required: true, message: "请输入孔位经度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "经度" },
        trigger: ["blur"],
      },
    ],
    hlLatitude: [
      { required: true, message: "请输入孔位纬度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "纬度" },
        trigger: ["blur"],
      },
    ],
    drillingDepth: [
      { required: true, message: "请输入钻孔深度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    groundElevation: [
      { required: true, message: "请输入地面高程", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    groundwaterLevel: [
      { required: false, message: "请输入地下水位", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    //土动力参数
    stNumber: [
      { required: true, message: "请输入土类号", trigger: "blur" },
      { max: 10, message: "最多输入10个字", trigger: ["change", "blur"] },
    ],
    geotechnicalName: [
      { required: true, message: "请输入岩土名称", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    // boreholeNumber:[],
    bdosSample: [
      { required: true, message: "请输入土样埋深", trigger: "blur" },
      { max: 10, message: "最多输入10个字", trigger: ["change", "blur"] },
    ],

    sdDensity: [
      { message: "请输入密度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio1: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×0.05)", trigger: "blur" },
      {

        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio2: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×0.10)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio3: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×0.50)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio4: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10-4×1.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio5: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×5.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio6: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×10.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio7: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×50.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    modulusRatio8: [
      { required: true, message: "请输入模量比(G/Gmax)剪应变(γ)（10^-4×100.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio1: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×0.05)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio2: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×0.10)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio3: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×0.50)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio4: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×1.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio5: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×5.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio6: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×10.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio7: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×50.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio8: [
      { required: true, message: "请输入阻尼比(λ)剪应变(γ)（10^-4×100.00)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    //钻孔计算模型
    geotechnicalName: [
      { required: true, message: "请输入岩土名称", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    stNumber: [
      { required: true, message: "请输入土类号", trigger: "blur" },
      { max: 10, message: "最多输入10个字", trigger: ["change", "blur"] },
    ],
    lbDepth: [
      { required: true, message: "请输入层底深度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    geotechnicalDensity: [
      { required: true, message: "请输入密度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留三位小数",
        validator: positivedecimals,
        options: { decimals: 3 },
        trigger: ["change", "blur"],
      },
    ],
    layerThickness: [
      { required: true, message: "请输入层厚", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    swVelocity: [
      { required: true, message: "请输入剪切波波速", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],

    //场地类别判别信息表
    eswv: [
      { required: true, message: "请输入20m等效剪切波速（M/s）", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: eswvRule,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    tocLayer: [
      { required: true, message: "请输入覆盖层厚度m", trigger: "blur" },
      {
        validator: thicknessRule,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    fieldType: [
      { required: true, trigger: "change",validator: fieldTypeRule },
    ],
    // 测线信息表格
    testNumber: [
      { required: false, message: "请输入测线编号", trigger: "blur" },
      { max: 10, message: "最多输入10个字", trigger: ["change", "blur"] },
    ],
    constructionUnit: [
      { required: false, message: "请输入施工单位", trigger: "blur" },
      { max: 100, message: "最多输入100个字", trigger: ["change", "blur"] },
    ],
    startLongitude: [
      { required: false, message: "请输入起点经度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "经度" },
        trigger: ["blur"],
      },
    ],
    startLatitude: [
      { required: false, message: "请输入起点纬度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "纬度" },
        trigger: ["blur"],
      },
    ],
    endLongitude: [
      { required: false, message: "请输入终点经度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "经度" },
        trigger: ["blur"],
      },
    ],
    endLatitude: [
      { required: false, message: "请输入终点纬度", trigger: "blur" },
      /*{
        message: "请输入正确数值，最多保留六位小数",
        validator: positivedecimals,
        options: { decimals: 6 },
        trigger: ["change", "blur"],
      },*/
      {
        message: "请输入正确数值，最多保留六位小数",
        validator: checkDecimalsLonLat,
        options: { decimals: 6, multi: false, type: "纬度" },
        trigger: ["blur"],
      },
    ],
    surveyMethod: [
      { required: false, message: "请输入勘探方式", trigger: "blur" },
      { max: 20, message: "最多输入20个字", trigger: ["change", "blur"] },
    ],
    testLength: [
      { required: false, message: "请输入长度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    // 地质剖面信息表格
    bisectName:[
      { required: true, message: "请输入剖面名称", trigger: "blur" },
      { max: 50, message: "最多输入50个字", trigger: ["change", "blur"] },
    ],
    sectionArea:[
      { required: true, message: "请输入剖面所在行政区（乡镇级别）", trigger: "change" },
    ],
    //场地地震动参数
    transcendProbability: [
      { required: true, message: "请输入超越概率", trigger: "blur" },
      { max: 20, message: "最多输入20个字", trigger: ["change", "blur"] },
    ],
    amaxGal: [
      { required: true, message: "请输入终点纬度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    bm: [
      { required: true, message: "请输入终点纬度", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留两位小数",
        validator: positivedecimals,
        options: { decimals: 2 },
        trigger: ["change", "blur"],
      },
    ],
    amax: [
      { required: true, message: "请输入amax", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    t1S: [
      { required: true, message: "请输入t1S", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    tgS: [
      { required: true, message: "请输入tgS", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    v: [
      { required: true, message: "请输入v", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    dampingRatio: [
      { message: "请输入阻尼比", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],

    aospFile: [
      { required: true, message: "请输入地震动峰值加速度归档（50年10%）(g)", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    periodicPoint: [
      { message: "请输入周期点", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],
    rsValue: [
      { message: "请输入反应谱值", trigger: "blur" },
      {
        message: "请输入正确数值，最多保留四位小数",
        validator: positivedecimals,
        options: { decimals: 4 },
        trigger: ["change", "blur"],
      },
    ],

    updateReason: [
      { required: true, message: "请输入修改原由", trigger: "blur" },
    ],
    updateDetailedInformation: [
      { required: true, message: "请输入修改详细信息", trigger: "blur" },
    ],
    deleteReason: [
      { required: true, message: "请输入删除原由", trigger: "blur" },
    ],

    // approval: [{ required: true, message: "请输入审批人", trigger: "blur" }],
    // approvalTime: [
    //   { required: true, message: "请输入审批时间", trigger: "blur" },
    // ],
    // approvalUnit: [
    //   { required: true, message: "请输入审批单位", trigger: "blur" },
    // ],
  },
  safetyRatingOptions: [],
  projectTypeOptions: [],
  //projectIdOptions: [],
  approvalStatusOptions: [
    {
      value: '2',
      label: '通过'
    }, {
      value: '3',
      label: '未通过'
    }, {
      value: '1',
      label: ' ',
      disabled: true
    }
  ],
  siteClassificationOptions: [
    {
      value: '10',
      label: 'Ⅰ0',
    },
    {
      value: '1',
      label: 'Ⅰ1',
    },
    {
      value: '2',
      label: 'Ⅱ',
    },
    {
      value: '3',
      label: 'Ⅲ',
    },
    {
      value: '4',
      label: 'Ⅳ',
    }
  ],
  parameterSourceOptions: [
    {
      value: '实验',
      label: '实验',
    },
    {
      value: '参考值',
      label: '参考值',
    },
    {
      value: '实验均值',
      label: '实验均值',
    },
  ]
});
const {
  showBaseInfo,
  showKeyMap,
  showKeyTable,
  showAccessory,
  params,
  rules,
  safetyRatingOptions,
  projectTypeOptions,
  //projectIdOptions,
  approvalStatusOptions,
  siteClassificationOptions,
  parameterSourceOptions,
  treeData
} = toRefs(data);

// 钻孔编号预选项
const boreholeNumberOptions = computed(() => {
  if (params.value.holeTableData) {
    return params.value.holeTableData.map(item => { return { label: item.boreholeNumber, value: item.boreholeNumber } })
  } else {
    return []
  }
})
// 校验钻孔编号是否存在
const checkHoleNum = (rule, value, callback) => {
  let flag = params.value.holeTableData.some(item => item.boreholeNumber == value)
  if (flag) {
    callback()
  } else {
    callback(new Error('钻孔编号需为成孔信息中现有钻孔编号！'))
  }
}
const scrollData = reactive({
  curHeight: 0,
  totalHeight: 1
})

// 是否展示审批类信息
const isShowApply = computed(
  () => {
    return (m_operateType.value === 'modify' || m_operateType.value === 'delete') && m_IsAdministrator.value && (params.value.status && params.value.status !== '0')
  }
);
// 获取右侧数据
const getScrollData = () => {
  treeData.value = []
  for (let key in proxy.$refs) {
    let cur = proxy.$refs[key]?.curTitleInfo
    if (cur) {
      if (!cur.own) {
        treeData.value.push(proxy.$refs[key].curTitleInfo)
      } else if (cur.own && cur.level === '2') {
        treeData.value.forEach(item => {
          item.children = item.children?.length > 0 ? item.children : []
          if (item.id == cur.own) {
            if (!item.children.includes(cur)) {
              item.children.push(cur)
              item.children.sort((a, b) => {
                return a.id.split('-')[1] - b.id.split('-')[1]
              })
            }
          }
        })
      } else if (cur.own && cur.level === '3') {
        treeData.value.forEach(item => {
          item.children = item.children?.length > 0 ? item.children : []
          item.children.forEach(itemnn => {
            itemnn.children = itemnn.children?.length > 0 ? itemnn.children : []
            if (itemnn.id == cur.own) {
              if (!itemnn.children.includes(cur)) {
                itemnn.children.push(cur)
                itemnn.children.sort((a, b) => {
                  return a.id.split('-')[1] - b.id.split('-')[1]
                })
              }
            }
          })
        })
      }
    }
  }
}

// 监听数据变化
watch(showBaseInfo, (newVal, oldVal) => {
  getScrollData()
}, { deep: true, immediate: true, flush: 'post' })
watch(showKeyMap, (newVal, oldVal) => {
  getScrollData()
}, { deep: true, immediate: true, flush: 'post' })
watch(showKeyTable, (newVal, oldVal) => {
  getScrollData()
}, { deep: true, immediate: true, flush: 'post' })
watch(showAccessory, (newVal, oldVal) => {
  getScrollData()
}, { deep: true, immediate: true, flush: 'post' })

// 拿标题的高度
const getTitleInfo = (treeData, allTitleInfo) => {
  let titleInfo = allTitleInfo || []
  treeData.map(item => {
    let refName = item.id
    proxy.$refs[refName].getTitleHeight()
    let curTitleInfo = proxy.$refs[refName].curTitleInfo
    titleInfo.push(curTitleInfo)
    if (item.children?.length > 0) {
      getTitleInfo(item.children, titleInfo)
    }
  })
  return titleInfo
}

// 滚动
const scrollBetter = ref()
const scrollbarRef = ref()
const detail = ref()
const scroll = ({ scrollTop }) => {
  let titleInfo = getTitleInfo(treeData.value)
  scrollData.totalHeight = detail.value.$el.clientHeight
  scrollData.curHeight = scrollTop
  titleInfo.reduce((prev, cur) => {
    if (scrollData.curHeight == prev.titleHeight) {
      scrollBetter.value.addActive(prev.id)
    } else if (scrollData.curHeight == cur.titleHeight) {
      scrollBetter.value.addActive(cur.id)
    } else if (scrollData.curHeight > prev.titleHeight && scrollData.curHeight < cur.titleHeight) {
      if (scrollData.curHeight - cur.titleHeight >= -100) {
        scrollBetter.value.addActive(cur.id)
      }
    }
    return cur
  })
}
const updateScroll = (id) => {
  proxy.$refs[id].getTitleHeight()
  let curTitleInfo = proxy.$refs[id].curTitleInfo
  scrollbarRef.value?.setScrollTop(curTitleInfo.titleHeight)
}

// 导入
const onImportParms = () => {
  dialogVisible.value = true;
};
// 登记保存
const onSave = () => {
  saveOrUpdateProject('save')
};
// 保存
const saveOrUpdateProject = (type) => {
  // 格式化时间未 HH：MM：ss 
  //params.value.historyEarthquakeCatalogueTableData.forEach(item => item.eoTimeHms = parseTime(new Date(item.eoTimeHms)).substring(11))
  const paramsp = {
    //基本情况
    apParam: {},
    //钻孔计算模型
    dhParams: params.value.drillingTableData,
    cruxElParams: params.value.lineInfoTableData, //测线信息lineInfoTableData
    cruxHecParams: params.value.historyEarthquakeCatalogueTableData, //历史地震目录historyEarthquakeCatalogueTableData
    cruxLayerPfParams: params.value.holeTableData, //成孔信息holeTableData
    cruxScParams: params.value.infoTableData, //场地类别判别信息infoTableData
    cruxSdParams: params.value.soilTableData, //土动力参数soilTableData
    profileInformationParams: params.value.geologicalInfoTableData, //新开展的地质剖面geologicalInfoTableData
    cruxSgmParams: params.value.siteTableData, //场地地震动参数siteTableData
  };
  // 深拷贝
  paramsp.apParam = JSON.parse(JSON.stringify(params.value))
  if (typeof params.value.longitudeP == 'string') {
    paramsp.apParam.longitude = params.value.longitudeP;
    // paramsp.apParam.longitude = params.value.longitudeP?.split(',')
  }
  if (typeof params.value.latitudeP == 'string') {
    paramsp.apParam.latitude = params.value.latitudeP;
    // paramsp.apParam.latitude = params.value.latitudeP?.split(',')
  }
  //zyt修改start
  paramsp.apParam.cpFile = params.value.cpFile;
  paramsp.apParam.geomText = params.value.geomText;

  //zyt修改end
  if (Array.isArray(params.value.administrativeRegion)) {
    paramsp.apParam.administrativeRegion = params.value.administrativeRegion.join(',')
  }
  paramsp.cruxElParams = params.value.lineInfoTableData.map(item => {
    const itemNew = JSON.parse(JSON.stringify(item))
    if (Array.isArray(itemNew.testAr)) {
      itemNew.testAr = itemNew.testAr.join(',')
    }
    return itemNew
  })

  paramsp.profileInformationParams = params.value.geologicalInfoTableData.map(item => {
    const itemNew = JSON.parse(JSON.stringify(item))
    if (Array.isArray(itemNew.sectionArea)) {
      itemNew.sectionArea = itemNew.sectionArea.join(',')
    }
    return itemNew
  })
  // paramsp.dzqhApAsicMapEntityadministrativeRegion = params.value.administrativeRegion.join(',')
  // paramsp.dzqhApAsicMapEntity.subDate = parseTime(params.value.subDate)
  let message = '成功!'
  if (type === 'save') {
    paramsp.apParam.subStatus = '0'
    message = '保存成功!'
  }
  if (type === 'submit') {
    paramsp.apParam.subStatus = '1'
    message = '提交成功!'
  }
  if (type === 'modify') {
    paramsp.apParam.projectId = m_projectId.value
    paramsp.apParam.subStatus = '1'
    paramsp.apParam.updateReason = params.value.updateReason
    if (m_IsAdministrator.value) {
      paramsp.apParam.reviewComments = params.value.reviewComments
      paramsp.apParam.approvalStatus = params.value.approvalStatus
    }
    message = '修改成功!'
  }
  if(type === 'submit' || type === 'modify'){
    // 当“项目情况信息表”中的“安评等级”选择“1或者2或者2+3”时，“场地地震动参数”为必填
    const arr = ['1', '2', '2+3'];
    if (arr.includes(params.value.safetyRating) && !paramsp.cruxSgmParams?.length) {
      proxy.$modal.msgWarning("请输入场地地震动参数!");
      return false;
    }
    if (params.value.geomText == "") {
    proxy.$modal.msgWarning("项目位置经纬度校验失败，请重新输入");
    return false;
  }
    proxy.$refs['detailForm'].validate((valid, fields) => {
    if (valid) {
      saveOrUpdateSaResults(paramsp)
        .then((res) => {
          if (res.code === 200 && res.data === '成功!') {
            ElMessage({
              type: 'success',
              message: message
            });
            router.push({ path: '/safetyEvalutionResultsBank/safetyEvaResCatManagement/projectInformationManagement' })
          }
        })
        .catch((err) => {
        });
    } else {
      proxy.$refs['detailForm'].scrollToField(Object.keys(fields)[0])
    }
  })
  }else{
    if(params.value.projectName==''||!params.value.projectName){
      proxy.$modal.msgWarning("请输入项目名称！")
      return;
    }
    saveOrUpdateSaResults(paramsp)
        .then((res) => {
          if (res.code === 200 && res.data === '成功!') {
            ElMessage({
              type: 'success',
              message: message
            });
            router.push({ path: '/safetyEvalutionResultsBank/safetyEvaResCatManagement/projectInformationManagement' })
          }
        })
        .catch((err) => {
        });
  }
}

//登记提交
const onSubmit = () => {
  if (m_operateType.value === 'delete') {
    deleteProject()
  } else if (m_operateType.value === 'modify') {
    saveOrUpdateProject(m_operateType.value)
  } else {
    saveOrUpdateProject('submit')
  }
};

// 删除
const deleteProject = () => {
  // const paramsp = {
  //   projectId: m_projectId.value,
  //   deleteReason: params.value.deleteReason,
  //   reviewComments: params.value.reviewComments,
  //   approvalStatus: params.value.approvalStatus
  // }
  const paramsp = {
    projectId: m_projectId.value,
    deleteReason: params.value.deleteReason,
    // updateReason: params.value.updateReason,
  }
  if (m_IsAdministrator.value) {
    // paramsp.projectId = m_projectId.value,
    // paramsp.deleteReason = params.value.deleteReason,
    paramsp.reviewComments = params.value.reviewComments,
      paramsp.approvalStatus = params.value.approvalStatus
  }
  ElMessageBox.confirm('确认删除数据, 是否继续?', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  }).then(() => {
    deleteSaResultsProject(paramsp).then((res) => {
      if (res.data === '删除成功') {
        ElMessage({
          type: 'success',
          message: '删除成功!'
        });
        router.push({ path: '/safetyEvalutionResultsBank/safetyEvaResCatManagement/projectInformationManagement' })
      }
    }).catch(err => {
      ElMessage({
        type: 'error',
        message: '删除失败!'
      });
    })
  }).catch(() => {
    ElMessage({
      type: 'info',
      message: '已取消删除'
    });
  });
}

const upload = reactive({
  isUploading: false,
  // headers: { token: "tokrn " + getToken() },
  url: import.meta.env.VITE_APP_BASE_API + "/attachment/uploadFile"
});

// 点击展开收起
function toggleShow(value) {
  switch (value) {
    case "baseInfo":
      showBaseInfo.value = !showBaseInfo.value;
      break;
    case "keyMap":
      showKeyMap.value = !showKeyMap.value;
      break;
    case "keyTable":
      showKeyTable.value = !showKeyTable.value;
      break;
    case "accessory":
      showAccessory.value = !showAccessory.value;
      break;
    default:
      break;
  }
}

// 获取用户
function getUserInfo() {
  getInfo(getUserId()).then(response => {
    params.value.registrant = response.user.userName
    params.value.registrationUnit = response.user.orgName
    params.value.createTime = parseTime(new Date())
  });
};

// 文件上传上传，一会名字要变，因为这是多个上传
/**文件上传前处理 */
function handleFileBeforeUpload(file) {
  proxy.$modal.loading("正在导入文件，请稍候...");
  return true
}

/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
// 上传失败
function handleFileUploadError(err) {
  proxy.$modal.closeLoading();
  proxy.$modal.msgError("导入文件失败");
}
const uploadIds = reactive({
  upload: ''
})
/** （一）区域地震构造图  文件上传成功处理 */
const handleFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  // proxy.$refs["uploadRef"].handleRemove(file);
  // proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.message + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  // queryParams.value.page = 1;
  params.value.rsMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是rsMap
  proxy.$refs['detailForm'].clearValidate('rsMap')
};
const fileuploadRsMap = ref(null)
const deleteImageRsMap = (attachId) => {
  fileuploadRsMap.value.fileList = []
  params.value.rsMap = null
}
// （二）本次新增加的断层剖面图fpMap   只需要加成功得事件就行，别的不用
const handlefpMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.fpMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是fpMap
  proxy.$refs['detailForm'].clearValidate('fpMap')
};
const fileuploadFpMap = ref(null)
const deleteImageFpMap = (attachId) => {
  fileuploadFpMap.value.fileList = []
  params.value.fpMap = null
}
//（三）近场地震构造图nfssMap
const handlenfssMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.nfssMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是nfssMap
  proxy.$refs['detailForm'].clearValidate('nfssMap')
};
const fileuploadNfssMap = ref(null)
const deleteImageNfssMap = (attachId) => {
  fileuploadNfssMap.value.fileList = []
  params.value.nfssMap = null
}

//（四）区域地震震中分布图reedMap
const handlereedMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.reedMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是reedMap
  proxy.$refs['detailForm'].clearValidate('reedMap')
};
const fileuploadReedMap = ref(null)
const deleteImageReedMap = (attachId) => {
  fileuploadReedMap.value.fileList = []
  params.value.reedMap = null
}
//（五）近场地震震中分布图nfeedMap
const handlenfeedMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.nfeedMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是nfeedMap
  proxy.$refs['detailForm'].clearValidate('nfeedMap')
};
const fileuploadNfeedMap = ref(null)
const deleteImageNfeedMap = (attachId) => {
  fileuploadNfeedMap.value.fileList = []
  params.value.nfeedMap = null
}
// （六）潜在震源区图
const handlepsaMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.psaMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是psaMap
  proxy.$refs['detailForm'].clearValidate('psaMap')
};
const fileuploadPsaMap = ref(null)
const deleteImagePsaMap = (attachId) => {
  fileuploadPsaMap.value.fileList = []
  params.value.psaMap = null
}
//（七）钻孔柱状图bhMap
const handlebhMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.bhMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是bhMap
  proxy.$refs['detailForm'].clearValidate('bhMap')
};
const fileuploadBhMap = ref(null)
const deleteImageBhMap = (attachId) => {
  fileuploadBhMap.value.fileList = []
  params.value.bhMap = null
}

//（八）地震动参数分区seismicPz
const handleseismicPzFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.seismicPz = attachId // 主要是这一行，绑定Java上的字段字段，在这是seismicPz
  proxy.$refs['detailForm'].clearValidate('seismicPz')
};
const fileuploadSeismicPz = ref(null)
const deleteImageSeismicPz = (attachId) => {
  fileuploadSeismicPz.value.fileList = []
  params.value.seismicPz = null
}

// （九）钻孔分布图bdMap
const handlebdMapFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.bdMap = attachId // 主要是这一行，绑定Java上的字段字段，在这是bdMap
  proxy.$refs['detailForm'].clearValidate('bdMap')
};
const fileuploadBdMap = ref(null)
const deleteImageBdMap = (attachId) => {
  fileuploadBdMap.value.fileList = []
  params.value.bdMap = null
}

//（十）工程地质剖面图egProfile
const handleegProfileFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.egProfile = attachId // 主要是这一行，绑定Java上的字段字段，在这是egProfile
  proxy.$refs['detailForm'].clearValidate('egProfile')
};
const fileuploadEgProfile = ref(null)
const deleteImageEgProfile = (attachId) => {
  fileuploadEgProfile.value.fileList = []
  params.value.egProfile = null
}

//上传报告
const handleUploadReportSuccess = (attachId) => {
  params.value.uploadReport = attachId
  // console.log("111")
  proxy.$refs['detailForm'].clearValidate('uploadReport')
};

// 地质剖面图片geologicalProfileImage
const handlelpgeologicalProfileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.geologicalProfileImage = attachId // 主要是这一行，绑定Java上的字段字段，在这是lpPicture
  proxy.$refs['detailForm'].clearValidate('geologicalProfileImage')
};

// 测线剖面图片lpPicture
const handlelineInfoTableDataCompare = (index,val)=>{
  params.value.lineInfoTableData[index].pposlMapPage = JSON.parse(JSON.stringify(val));
  params.value.lineInfoTableData[index].pposlMap = JSON.parse(JSON.stringify(val))[0].attachId;
}
const deleteLineInfoTableDataCompare = (index)=>{
  params.value.lineInfoTableData[index].pposlMapPage = [];
  params.value.lineInfoTableData[index].pposlMap = '';
}
const handlelpPictureFileSuccess = (attachId) => {
  // upload.isUploading = false;
  // proxy.$modal.closeLoading();
  params.value.lpPicture = attachId // 主要是这一行，绑定Java上的字段字段，在这是lpPicture
  proxy.$refs['detailForm'].clearValidate('lpPicture')
};

//（六）新开展的地质剖面
const handlegeologicalInfoTableCompare = (index,val)=>{
  params.value.geologicalInfoTableData[index].pposlMapPage = JSON.parse(JSON.stringify(val));
  params.value.geologicalInfoTableData[index].pposlMap = JSON.parse(JSON.stringify(val))[0].attachId;
}
const deleteGeologicalInfoTableCompare = (index)=>{
  params.value.geologicalInfoTableData[index].pposlMapPage = [];
  params.value.geologicalInfoTableData[index].pposlMap = '';
}

const handlleGeologicalDelete = (index, row) => {
  params.value.geologicalInfoTableData.splice(index, 1);
};
const handleGeologicalAdd = () => {
  params.value.geologicalInfoTableData.push({
    id: "1",
    bisectName: "",
    sectionArea: "",
    longitude: "",
    latitude: "",
    pposlMap:'',
    pposlMapPage:[]
  });
};

//（七）场地地震动参数
const handlleSiteDelete = (index, row) => {
  params.value.siteTableData.splice(index, 1);
};
const handleSiteAdd = () => {
  params.value.siteTableData.push({
    id: "",
    transcendProbability: "",
    amaxGal: "",
    bm: "",
    amax: "",
    t1S: "",
    tgS: "",
    v: "",
    dampingRatio: "",
  });
};

//测线信息表格
const handlleLineInfoDelete = (index, row) => {
  params.value.lineInfoTableData.splice(index, 1);
};
const handleLineInfoAdd = () => {
  let haveEmpty = false
  if (params.value.lineInfoTableData && params.value.lineInfoTableData.length > 0) {
    for (let i = 0; i < params.value.lineInfoTableData.length; i++) {
      const infoItem = params.value.lineInfoTableData[i]
      if (!infoItem.testNumber || infoItem.testNumber === '') {
        haveEmpty = true;
        break;
      }
    }
  }
  if (haveEmpty) {
    ElMessage({
      type: 'warn',
      message: '请填写测线编号'
    });
    return;
  }
  params.value.lineInfoTableData.push({
    id: "3",
    testNumber: "",
    testAr: "",
    constructionUnit: "",
    startLongitude: "",
    startLatitude: "",
    endLongitude: "",
    endLatitude: "",
    surveyMethod: "",
    testLength: "",
    pposlMap:'',
    pposlMapPage:[]
  });
};

//场地类别判别信息表
const handlleInfoDelete = (index, row) => {
  params.value.infoTableData.splice(index, 1);
};
const handleInfoAdd = () => {
  params.value.infoTableData.push({
    id: "3",
    boreholeNumber: "",
    eswv: "",
    tocLayer: "",
    fieldType: "",
  });
};

//钻孔计算模型
const handleDrillingDelete = (index, row) => {
  params.value.drillingTableData.splice(index, 1);
};
const handleDrillingAdd = () => {
  params.value.drillingTableData.push({
    id: 1,
    geotechnicalName: "",
    stNumber: "",
    lbDepth: "",
    geotechnicalDensity: "",
    layerThickness: "",
    swVelocity: "",
  });
};

//土动力参数
const handleSoilDelete = (index, row) => {
  params.value.soilTableData.splice(index, 1);
};
const handleSoilAdd = () => {
  params.value.soilTableData.push({
    stNumber: "",
    geotechnicalName: "",
    boreholeNumber: "",
    bdosSample: "",
    parameterSource: "",
    sdDensity: "",
  });
};

//成孔信息
const handleHoleDelete = (index, row) => {
  params.value.holeTableData.splice(index, 1);
};
const handleHoleAdd = () => {
  console.log(params)
  params.value.holeTableData.push({
    projectName: "",
    boreholeNumber: "",
    hlLongitude: "",
    hlLatitude: "",
    groundElevation: "",
    groundwaterLevel: "",
  });
};

//（一）历史地震目录
const handleHistoryDelete = (index, row) => {
  params.value.historyEarthquakeCatalogueTableData.splice(index, 1);
};
const handleHistoryAdd = () => {
  params.value.historyEarthquakeCatalogueTableData.push({
    id: params.value.historyEarthquakeCatalogueTableData.length + 1,
    eoTimeYmd: "",
    eoTimeHms: "",
    northLatitude: "",
    eastLongitude: "",
    magnitude: "",
    depth: "",
    epicentralIntensity: "",
    accuracy: "",
    erpName: "",
  });
};

/** 安评等级列表 */
const getSafetyRatingList = () => {
  safetyRatingList()
    .then((res) => {
      if (res.code === 200) {
        safetyRatingOptions.value = [];
        const options = res.data.sort((a, b) => a.sort - b.sort);
        options.forEach((item) => {
          safetyRatingOptions.value.push({
            value: item.dictItemCode,
            label: item.dictItemName,
          });
        });
      }
    })
    .catch((err) => {
    });
};

/** 工程类别列表 */
const getProjectTypeList = () => {
  projectTypeOptions.value = [
    {attachId: null,description: "14.国家级信息中心建筑（含大型、超大型数据中心）。\r【释义】本条是指重要的信息中心建筑，主要根据功能用途和重要性确定。国家级信息中心建筑应满足以下条件之一：\r（1）大型、超大型数据中心，其中大型数据中心一般是指机架数量为3000 至10000 个，超大型数据中心一般是指机架数量超过10000 个；\r（2）其他国家级信息中心建筑。\r【相关标准】G B 50223-2008《建筑工程抗震设防分类标准》第6.0.10 条。\r",dictCod: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "国家信息枢纽节点",dictName: "工程类别",sort: 6},
    {attachId: null,description: "4.坝高超过200 或库容大于100 亿m 3 的大（1）型工程。\r【释义】本条是指水利水电工程中的大（1）型工程，主要根据建设规模、场地条件确定：\r大（1）型工程应满足以下条件之一：\r（1）坝高超过200m ；\r（2）库容大于100 亿m 3；\r（3）位于7 度及以上地区，且坝高超过150m 。\r【相关标准】GB51247-2018《水工建筑物抗震设计标准》第1.0.5条及条文说明；SL252-2017《水利水电工程等级划分及洪水标准》第3.0.1条及条文说明。\r5.坝高超过150m 大（1）型工程，高度为90m以上的1级、2级大坝，抽水蓄能电站I等工程的主要建筑物。\r【释义】本条是指大坝和抽水蓄能电站2类重要雍水建筑物，此类建筑物不一定是高坝大库，但是一旦失事可能会导致严重后果，主要根据场地条件、重要性和建设规模确定：\r（1）大坝应同时满足以下3个条件：①场地位于7度及以上地区；②大坝等级为1级或2级大坝，即Ⅰ等、Ⅱ等工程中的大坝；③坝高90米以上。需要说明的是：对于3级大坝符合提级指标时，应同时满足以下3 个条件：\r①场地位于7 度及以上地区；\r②坝高超过70 米的土石坝，或坝高超过100 米混凝土、浆砌石坝；\r③大坝等级为3 级大坝，即Ⅲ等工程中的大坝。\r（2）抽水蓄能电站应同时满足以下3 个条件：\r①场地位于7 度及以上地区；\r②I等工程；\r③主要建筑物，一般是指闸、坝、溢洪道、发电厂房等水工建筑物。\r【相关标准】GB51247-2018《水工建筑物抗震设计标准》第1.0.6条及条文说明；SL252-2017《水利水电工程等级划分及洪水标准》第2.0.6条、3.0.1条、4.2.1条、4.2.2条及条文说明。\r6.大型引水、调水工程中的重要建筑物。\r【释义】本条是指引水、调水工程等重要雍水建筑物，此类建筑物不一定是高坝大库，但是一旦失事可能会导致严重后果，主要根据场地条件、重要性和建设规模确定：引水、调水工程应同时满足以下2个条件：\r①场地位于7度及以上地区；\r②重要建筑物，一般是在引水调水工程中起挡水、泄水等作用的建筑物。\r【相关标准】G B 51247-2018《水工建筑物抗震设计标准》第1.0.6条及条文说明；SL252-2017《水利水电工程等级划分及洪水标准》第2.0.6条、3.0.1条、4.2.1条、4.2.2条及条文说明。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "特大型水利水电设施",dictName: "工程类别",sort: 2,},
    {attachId: null,description: "1.核电厂、核热电厂、核供汽供热厂、核能海水淡化厂等核动力厂及装置。\r【释义】本条是指核工程中的核动力厂，主要根据功能用途确定，包括核电厂、核热电厂、核供汽供热厂、核能海水淡化厂等各种功能用途的核动力厂及装置。\r【相关标准】《中华人民共和国核安全法》第二条；GB50267-2019《核电厂抗震设计规范》第1.0.3 条、1.0.6 条及条文说明。\r2.核燃料生产、加工、贮存和后处理设施等核燃料循环设施。\r【释义】本条是指核工程中除核动力厂以外的其他反应堆，研究堆、实验堆、临界装置等各类反应堆均在该范围之内。\r【相关标准】《中华人民共和国核安全法》第二条；GB50267-2019《核电厂抗震设计规范》第1.0.3条、1.0.6 条及条文说明。\r3.浮动核动力装置的系泊装换料船坞、码头。\r【释义】本条是指核工程中的船坞码头，主要根据功能用途确定，专指浮动核动力装置的系泊装换料船坞、码头。\r【相关标准】《中华人民共和国核安全法》第二条；GB50267-2019《核电厂抗震设计规范》第1.0.3条、1.0.6条及条文说明。\r1.核电厂、核热电厂、核供汽供热厂、核能海水淡化厂等核动力厂及装置。\r【释义】本条是指核工程中的核动力厂，主要根据功能用途确定，包括核电厂、核热电厂、核供汽供热厂、核能海水淡化厂等各种功能用途的核动力厂及装置。\r【相关标准】《中华人民共和国核安全法》第二条；GB50267-2019《核电厂抗震设计规范》第1.0.3 条、1.0.6 条及条文说明。\r2.核燃料生产、加工、贮存和后处理设施等核燃料循环设施。\r【释义】本条是指核工程中除核动力厂以外的其他反应堆，研究堆、实验堆、临界装置等各类反应堆均在该范围之内。\r【相关标准】《中华人民共和国核安全法》第二条；GB50267-2019《核电厂抗震设计规范》第1.0.3条、1.0.6 条及条文说明。\r3.浮动核动力装置的系泊装换料船坞、码头。\r【释义】本条是指核工程中的船坞码头，主要根据功能用途确定，专指浮动核动力装置的系泊装换料船坞、码头。\r【相关标准】《中华人民共和国核安全法》第二条；GB50267-2019《核电厂抗震设计规范》第1.0.3条、1.0.6条及条文说明。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "重大涉核设施",dictName: "工程类别",sort: 1,},
    {attachId: null,description: "7.万千瓦级新能源基地：风电、光伏、储能电站等。\r【释义】能源发电装机容量达万千瓦级以上。8.亿吨级煤炭基地。\r【释义】煤炭资源储量大于1 亿吨的煤炭基地。\r9.大型石油天然气生产、储存基地。\r【释义】本条是指单罐库容不小于10 万立方米、总库容不小于100 万立方米的原油储备基地，单罐库容不小于5 千立方米、总库容不小于5 万立方米的成品油储备库，单罐库容不小于1 万立方米、总库容不小于10 万立方米的LNG 接收站，1 万立方米的液化石油气库等。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "重大能源基地",dictName: "工程类别",sort: 3,},
    {attachId: null,description: "10.油气干线输送管道。\r【释义】本条是指穿越或临近晚更新世（10 万年）以来活动断层，或位于基本地震动峰值加速度0.10g 及以上地区等抗震不利地段的油气干线输送管道，主要根据场地条件确定。\r油气干线输送管道应满足以下条件之一：\r（1）管道穿越或临近晚更新世（10 万年）以来活动断层，其中“临近”是指管道场地（管道轴线两侧各200 米宽的范围）内是否有晚更新世（10 万年）以来活动断层；\r（2）场地位于7 度及以上地区。\r【相关标准】GB/T50470-2017《油气输送管道线路工程抗震技术规范》第4.2.1条及条文说明。\r11.石油化工钢制设备中公称容积大于等于30000m 3的立式圆筒形储罐和高度大于80m的裙座式直立设备。\r【释义】本条是指石油化工中受地震破坏后的危害程度为较为严重的钢制设备，主要根据建设规模确定。\r石油化工钢制设备应满足以下条件之一：\r（1）公称容积≥30000m 3 的立式圆筒形储罐；\r（2）高度＞80m 的裙座式直立设备。\r【相关标准】GB50761-2018《石油化工钢制设备抗震设计规范》第3.1.1条及条文说明。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "油气储运骨干管线",dictName: "工程类别",sort: 4,},
    {attachId: null,description: "12.国家和区域电力调度中心。\r【释义】本条是指电力生产调度和管理所需要的设备提供运行环境及相关人员办公的场所，可以是一幢建筑物或建筑物的一部分，该类场所按照特殊设防类进行设防，主要根据功能用途和级别确定。\r电力调度中心应同时满足以下2个条件：\r（1）场所具有电力生产调度和管理的设备和功能；\r（2）国家级或区域级。\r【相关标准】GB50223-2008《建筑工程抗震设防分类标准》第3.0.2条、3.0.3条、5.2.3条及条文说明。\r13.国家骨干电网枢纽变电站。\r【释义】枢纽变电站坐落于电力系统的枢纽点，电压等级一般为330kV 及以上，关联多个电源，出现回路多，变电容量大;全站停电后将致使大面积停电，或系统土崩瓦解，枢纽变电站对电力系统运转的平稳和可靠性起到最主要功用。处于国家骨干电网中的枢纽变电站属于此条摸排范围。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "国家电力系统枢纽工程",dictName: "工程类别",sort: 5,},
    {attachId: null,description: "18.中央级救灾物资储备库。\r【释义】本条是由民政部确定的中央级救灾物资储备库，省、市、县级救灾物资储备库不在该范围内。中央级救灾物资储备库属于极为重要的应急服务设施，为确保其地震安全，需要开展地震安全性评价。\r【相关标准】G B T 51327-2018《城市综合防灾规划标准》第7.1.4 条。\r19.大型风洞设施、大型射电望远镜等有特殊需要的科学实验和重大科学装置工程。\r【释义】本条是指重大科学装置工程，主要根据功能用途和重要性确定。\r重大科学装置工程应包括以下类型：\r（1）大型风洞设施；\r（2）大型射电望远镜；\r（3）其他特殊需要的科学实验和重大科学装置工程。\r20.其他可能影响国计民生、国家战略、国家安全的重大基础设施。\r【释义】本条是兜底性条款，鉴于前述重大基础设施类型可能无法包含所有应当开展抗震设防基本情况摸排的工程，此条由各省局从国计民生、国家战略、国家安全等方面以及当地经济发展特点确定重大基础设施补充范围，例如重要铁路、重要港口等。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "其他重大基础设施",dictName: "工程类别",sort: 8,},
    {attachId: "3a792cdcfef64b76ab35c8a66cb371f8",description: "15.公路A 类桥梁、特长隧道。\r【释义】本条是指公路工程中重要的桥梁和隧道工程，通常是对抗震救灾以及经济、国防上具有重要意义或破坏后修复（抢修）困难的公路工程，主要根据场地条件和重要性确定。桥梁应满足以下条件之一：\r（1）属于A 类桥梁，即单跨跨径超过150 米的特大桥；\r（2）场地位于8 度及以上地区，且属于B 类桥梁。B 类桥梁为单跨跨径不超过150 米的高速公路、一级公路上的桥梁，以及单跨跨径不超过150 米的二级公路上的特大桥、大桥。特大桥、大桥的定义如下表所示:\r \r隧道工程应满足以下条件之一：\r（1）独立形式；\r（2）属于特长隧道，即隧道长度大于3000 米。\r【相关标准】JTG/T2231-01-2020《公路桥梁抗震设计规范》第5.1.4、3.1.1条;JTGB02-2013《公路工程抗震规范》第1.0.4条；JTGB01-2014《公路工程技术标准》第6.0.2、8.0.2条。\r16.水深大于20m、墩高大于80m、跨度大于150m及其它技术复杂、修复困难的铁路公路桥梁。\r【释义】本条是指特别重要的铁路工程中的复杂铁路桥梁，主要根据建设规模和复杂程度确定。铁路桥梁应同时满足以下条件：\r（1）水深大于20 米；\r（2）墩高大于80 米；\r（3）跨度大于150 米；\r（4）技术复杂或修复困难。\r【相关标准】GB50111-2006《铁路工程抗震设计规范(2009年版)》第1.0.3、1.0.4的条文说明。\r17.过江过海隧道。\r【释义】本条是指综合考虑经济、安全、修复的难易程度及工程在路网中的影响等因素，对越江隧道、海底隧道等特别重要的铁路工程，应进行地震安全性评价。\r【相关标准】GB50111-2006《铁路工程抗震设计规范(2009年版)》第1.0.3、1.0.4 的条文说明。\r",dictCode: "dzqhgclb",dictId: "201048",dictItemCode: "dzqhgclb",dictItemName: "重大交通基础设施",dictName: "工程类别",sort: 7,},
  ]
  projectTypeOptions.value.forEach(item=>{
      item.value = item.dictItemName,
      item.label = item.dictItemName,
      item.description = item.description,
      item.attachId = item.attachId
  })
  // projectTypeList()
  //   .then((res) => {
  //     if (res.code === 200) {
  //       projectTypeOptions.value = [];
  //       res.data.forEach((item) => {
  //         projectTypeOptions.value.push({
  //           value: item.dictItemName,
  //           label: item.dictItemName,
  //           description: item.description,
  //           attachId: item.attachId
  //         });
  //         console.log(projectTypeOptions.value,'lallalal');
          
  //       });
  //     }
  //   })
  //   .catch((err) => {
  //   });
};

// 工程类别列表改变
const projectTypeChange = (val) => {
  const typeoption = projectTypeOptions.value.find(item => item.label === val)
  console.log(typeoption);
  if (typeoption) { 
    params.value.projectTypeRemarks = typeoption.description
    params.value.projectTypeAttchPath = typeoption.attachId ? import.meta.env.VITE_APP_BASE_API + "/attachment/downLoadFile?attachId=" + encodeURIComponent(typeoption.attachId) : ''
  }
}

/** 钻孔依托的项目 */
// const getprojectIdList = () => {
//   queryAllProject()
//     .then((res) => {
//       if (res.code === 200) {
//         projectIdOptions.value = [];
//         res.data.forEach((item) => {
//           projectIdOptions.value.push({
//             value: item.projectId,
//             label: item.projectName,
//           });
//         });
//       }
//     })
//     .catch((err) => {
//     });
// };

// 历史操作记录
const onHistoryRecord = () => {
  const paramsp = {
    originalDataId: params.value.originalDataId
  }
  queryHistory(paramsp).then(res => {
    if (res.code === 200) {
      res.data.forEach(item => {
        params.value.updateDetailedInformation = `${item.company}${item.userName}于${item.operationTime}修改了${item.tableName}${item.field}信息，更改前：${item.beforeUpdating}，更改后：${item.afterUpdate}`
      })
    }
  }).catch(err => {
    console.log(err)
  })
}

// 初始化回显表单
const initFormData = (formData) => {
  if (formData.dzqhApAsicMapEntity) {
    // 基础信息
    params.value = formData.dzqhApAsicMapEntity
    // 审批状态
    approvalStatusInit.value = formData.dzqhApAsicMapEntity.approvalStatus
    // 经纬度
    // params.value.controlPoints = Number(formData.dzqhApAsicMapEntity.controlPoints)
    params.value.longitudeP = formData.dzqhApAsicMapEntity.longitude || ''
    params.value.latitudeP = formData.dzqhApAsicMapEntity.latitude || ''
    //zyt修改start
    params.value.cpFile = formData.dzqhApAsicMapEntity.cpFile || ''
    params.value.geomText = formData.dzqhApAsicMapEntity.geomText || ''
    //zyt修改end
    if (typeof formData.dzqhApAsicMapEntity.administrativeRegion == 'string') {
      params.value.administrativeRegion = formData.dzqhApAsicMapEntity.administrativeRegion.split(',')
      console.log('params.value.administrativeRegion', params.value.administrativeRegion)
    }
    if (formData.dzqhApCruxElEntityList) {
      params.value.lineInfoTableData = formData.dzqhApCruxElEntityList.map(item => {
        if (typeof item.testAr == 'string') {
          item.testAr = item.testAr.split(',')
        }
        return item
      })
    } else {
      params.value.lineInfoTableData = []
    }
    // 地质剖面信息表格
    if (formData.profileInformationList) {
      params.value.geologicalInfoTableData = formData.profileInformationList.map(item => {
        if (typeof item.sectionArea == 'string') {
          item.sectionArea = item.sectionArea.split(',')
        }
        return item
      })
    } else {
      params.value.geologicalInfoTableData = []
    }
  }
  if (formData.dzqhApCruxElEntityList) {
      params.value.lineInfoTableData = formData.dzqhApCruxElEntityList.map(item => {
        if (typeof item.testAr == 'string') {
          item.testAr = item.testAr.split(',')
        }
        return item
      })
    } else {
      params.value.lineInfoTableData = []
    }
  params.value.drillingTableData = formData.dzqhApCruxDhEntityList || []
  //测线信息lineInfoTableData
  params.value.lineInfoTableData = formData.dzqhApCruxElEntityList || []
  params.value.geologicalInfoTableData = formData.profileInformationList || []
  params.value.lineInfoTableData&& params.value.lineInfoTableData.forEach(item=>{
    if(!item.pposlMap){
      item.pposlMap = '';
      item.pposlMapPage = [];
    }else{
      item.pposlMapPage = [item.pposlMapPage]
    }
  })
  params.value.geologicalInfoTableData&&params.value.geologicalInfoTableData.forEach(item=>{
    if(!item.pposlMap){
      item.pposlMap = '';
      item.pposlMapPage = [];
    }else{
      item.pposlMapPage = [item.pposlMapPage]
    }
  })
  params.value.historyEarthquakeCatalogueTableData = formData.dzqhApCruxHecEntityList || []
  //历史地震目录historyEarthquakeCatalogueTableData
  // params.value.historyEarthquakeCatalogueTableData = formData.dzqhApCruxHecEntityList.map(item => {
  //   item.eoTimeHms = new Date(`${item.eoTimeYmd} ${item.eoTimeHms}`)
  //   return item
  // })
  params.value.holeTableData = formData.dzqhApCruxLayerPfEntityList || []//成孔信息holeTableData
  params.value.infoTableData = formData.dzqhApCruxScEntityList || [] //场地类别判别信息infoTableData
  params.value.soilTableData = formData.dzqhApCruxSdEntityList || []//成孔信息holeTableData
  params.value.siteTableData = formData.dzqhApCruxSgmEntityList || params.value.siteTableData //场地类别判别信息infoTableData
  params.value.fileMap = formData.fileMap || []
  params.value.attachList = (formData.fileMap&&formData.fileMap.uploadReport)?[formData.fileMap.uploadReport]:[] // 附件
}

// 修改 删除的回显函数
const getFormData = (projectid) => {
  const querParams = {
    projectId: projectid
  }
  getSaResultsById(querParams).then(res => {
    if (res.code === 200) {
      // 初始化回显表单
      initFormData(res.data)
      // onHistoryRecord()
    }
  }).catch(error => {
  })
}
// 获取用户角色
const getUserRole = () => {
  queryUserRole().then(res => {
    if (res.code === 200) {
      m_IsAdministrator.value = res.data
    }
  }).catch(error => {
  })
}

// 操作类型
const m_operateType = ref('save')
const m_projectId = ref('')
// 判断是否管理员
const m_IsAdministrator = ref(false)

// 挂载
onMounted(() => {
  // 获取用户角色
  getUserRole();
  getSafetyRatingList();
  getProjectTypeList();
  //getprojectIdList();
  getUserInfo();
  getScrollData();
  if (route.query.operate && route.query.projectId) {
    m_operateType.value = route.query.operate
    m_projectId.value = route.query.projectId
    getFormData(m_projectId.value)
  } else {
    // 查询用户未提交数据 
    notSubmitted().then(res => {
      initFormData(res.data);
    }).catch(err => {
      console.log(err.message);
    })
  }
});

const xzqChange = (value) => {
  params.value.administrativeRegion = value
}
const xzqChange1 = (value) => {
  params.value.lineInfoTableData.testAr = value;
  // params.value.testAr = value
}
const xzqChange2 = (value) => {
  // params.value.testAr = value
}
/** 行政区列表 */
const xzqProps = {
  lazy: true,
  lazyLoad(node, resolve) {
    let { value } = node
    // 没有value,说明是省，赋值1
    if (!value) {
      value = 1
    }
    // 构造参数
    const params = {
      divisionId: value
    }
    xzqList(params).then((res) => {
      if (res.code === 200) {
        const nodes = []
        res.data.forEach(item => {
          nodes.push({
            value: item.value,
            label: item.name,
            leaf: item.isLeaf,
          }
          )
        })
        resolve(nodes)
      }
    })
  },
}


/*地图使用start*/
const minList = ref([]);//要上传的文件的后缀名数组
const nameList = ref([]);//要上传的文件的文件名数组
const uploadInfoVisible = ref(false);//是否显示上传消息弹窗
const uploadMsg = ref("");//上传结果返回值
const selectUploadFileClick = () => {
  document.getElementById("saResults-button-selectfile").click()
}
//选择文件
function uploadFileChange() {
  let uploadinputFiles = document.getElementById("saResults-button-selectfile").files;
  minList.value = [];
  nameList.value = [];
  for (let i = 0; i < uploadinputFiles.length; i++) {
    console.log("uploading: " + uploadinputFiles[i].name);
    // 获取这个文件的后缀名
    minList.value.push(uploadinputFiles[i].name.slice(uploadinputFiles[i].name.length - 3, uploadinputFiles[i].name.length));
    nameList.value.push(uploadinputFiles[i].name.split(".")[0]);
  }
  if (!judgeIsOnce(minList.value)) {
    proxy.$modal.msgError('上传数量限制:.dbf、.prj、.shp、.shx、.cpg文件各1个;.sbn、.sbx、.shp.xml文件至多一个。');
    return;
  } else if (!judgeName(nameList.value)) {
    proxy.$modal.msgError('文件名请保持一致！');
    return;
  }
  uploadFileClick();
}
//上传文件
function uploadFileClick() {
  let uploadinput = document.getElementById("saResults-button-selectfile");
  if (uploadinput.value == "") {
    proxy.$modal.msgError('上传前请先选择文件！');
    return;
  }
  let formData = new FormData();
  for (let i = 0; i < uploadinput.files.length; i++) {
    formData.append('files', uploadinput.files[i]);
  }
  formData.append("projectId", route.query.projectId);
  formData.append("projectName", params.value.projectName);
  proxy.$modal.loading("正在上传文件，请稍候...");
  //上传
  uploadShpFile(formData).then((response) => {
    nextTick(() => {
      let msg = response.data;
      proxy.$modal.closeLoading();
      uploadMsg.value = msg;//上传消息返回值
      if (msg.indexOf("上传成功.") != -1) {
        if (msg.indexOf("导入成功") != -1) {
          uploadMsg.value = msg.split("导入成功")[0] + "成功导入1条数据.";
          let tempStr = msg.split("导入成功")[1];
          let tempArr = tempStr.split(";空间数据");
          params.value.cpFile = tempArr[0];
          let tempGeomLonArr = tempArr[1].split("经度");
          params.value.geomText = tempGeomLonArr[0];
          let tempLonLatArr = tempGeomLonArr[1].split("纬度");
          //经纬度字符串
          params.value.longitudeP = tempLonLatArr[0];
          params.value.latitudeP = tempLonLatArr[1];
        }
      }
      uploadInfoVisible.value = true;//是否显示上传消息弹窗
    });
  }).catch(err => {
    proxy.$modal.closeLoading();
    proxy.$modal.msgError("上传文件失败");
  })
}

//校验shp文件类型
function judgeIsOnce(list) {
  // ["dbf","prj","shp","shx","cpg"];
  let dbf = 0, prj = 0, shp = 0, shx = 0, cpg = 0, sbn = 0, sbx = 0, xml = 0;
  for (let i = 0; i < list.length; i++) {
    let item = list[i];
    if (item == 'dbf') dbf++;
    if (item == 'prj') prj++;
    if (item == 'shp') shp++;
    if (item == 'shx') shx++;
    if (item == 'cpg') cpg++;
    if (item == 'sbn') sbn++;
    if (item == 'sbx') sbx++;
    if (item == 'xml') xml++;
  }
  if (dbf == 1 && prj == 1 && shp == 1 && shx == 1 && cpg == 1 && sbn < 2 && sbx < 2 && xml < 2) return true;
  else return false;
}
//校验shp文件名称
function judgeName(list) {
  let name = list[0];
  let result = list.filter(function (item) {
    return item == name;
  })
  if (result.length == list.length) return true;
  else return false;
}

//关闭上传消息弹窗
function uploadHandleClose() {
  uploadInfoVisible.value = false;//是否显示上传消息弹窗
}

//安评成果目录根据经纬度获取geomText值
function getGeomTextByLonLatStr() {
  const paramsp = JSON.parse(JSON.stringify(params.value));
  if (typeof params.value.longitudeP == 'string') {
    // paramsp.longitude = params.value.longitudeP?.split(',')
    paramsp.longitude = params.value.longitudeP
  }
  if (typeof params.value.latitudeP == 'string') {
    // paramsp.latitude = params.value.latitudeP?.split(',')
    paramsp.latitude = params.value.latitudeP
  }
  if (Array.isArray(params.value.administrativeRegion)) {
    paramsp.administrativeRegion = params.value.administrativeRegion.join(',')
  }
  getGeomTextByLonLatString(paramsp)
    .then((res) => {
      if (res.code === 200) {
        params.value.geomText = res.data;
      }
    })
    .catch((err) => {
      params.value.geomText = "";
    });
}
/*地图使用end*/
</script>

<style scoped lang="scss">
.el-form-register {
  .project-type-remarks {
    img {
      float: left;
    }

    min-height: 50px;
    max-height: 200px;
    overflow: auto;
  }

  .img-containers {
    .upload-file {
      padding: 12px;
    }
  }

  .column-header-sign {
    color: red;
  }

  .el-form-ls {
    div {
      h4 {
        font-size: 16px;
        font-weight: bold;
        color: #107ce5;
      }

      div {
        h5 {
          font-size: 16px;
          font-weight: bold;
          color: #333333;
          text-align: center;
        }
      }
    }
  }
}

.bottom-button {
  position: sticky;
  top: 10px;

  div:nth-child(2) {
    margin: 10px 0;
  }
}

.downloadModel {
  font-size: 16px;
  line-height: 60px;

  span {
    color: #107ce5;
    cursor: pointer;
  }
}

.newDevelopGeologicalProfiles{
  // :deep()
}
</style>